C
C
Transition from Http.QuickPutStr to Http.HttpNoBody
Provides instructions for replacing deprecated QuickPutStr method calls with HttpNoBody.Chilkat C Downloads
#include <C_CkHttp.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttp http;
const char *url;
const char *responseBody;
HCkHttpResponse responseOut;
success = FALSE;
http = CkHttp_Create();
// ...
// ...
url = "https://example.com/test";
// ------------------------------------------------------------------------
// The QuickPutStr method is deprecated:
responseBody = CkHttp_quickPutStr(http,url);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpNoBody.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
responseOut = CkHttpResponse_Create();
success = CkHttp_HttpNoBody(http,"PUT",url,responseOut);
if (success == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkHttpResponse_Dispose(responseOut);
return;
}
responseBody = CkHttpResponse_bodyStr(responseOut);
CkHttp_Dispose(http);
CkHttpResponse_Dispose(responseOut);
}