Sample code for 30+ languages & platforms
Node.js

Transition from Http.PutText to Http.HttpStr

Provides instructions for replacing deprecated PutText method calls with HttpStr.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var http = new chilkat.Http();

    var verb = "PUT";
    var url = "https://example.com/";
    var textData = "This is the HTTP request body";
    var charset = "utf-8";
    var contentType = "text/plain";

    //  ------------------------------------------------------------------------
    //  The PutText method is deprecated:

    var responseBody = http.PutText(url,textData,charset,contentType,false,false);
    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(verb,url,textData,charset,contentType,responseOut);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

    responseBody = responseOut.BodyStr;

}

chilkatExample();