Node.js
Node.js
Transition from Http.PostJson to Http.HttpStr
Provides instructions for replacing deprecated PostJson method calls with HttpStr.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var http = new chilkat.Http();
var url = "https://example.com/something";
var jsonText = "{ ... }";
// ------------------------------------------------------------------------
// The PostJson method is deprecated:
// responseObj: HttpResponse
var responseObj = http.PostJson(url,jsonText);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpStr.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
var responseOut = new chilkat.HttpResponse();
success = http.HttpStr("POST",url,jsonText,"utf-8","application/json",responseOut);
if (success == false) {
console.log(http.LastErrorText);
return;
}
}
chilkatExample();