Sample code for 30+ languages & platforms
Node.js

Transition from Http.PText to Http.HttpStr

Provides instructions for replacing deprecated PText 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 PText method is deprecated:

    // responseObj: HttpResponse
    var responseObj = http.PText(verb,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;
    }


}

chilkatExample();