Sample code for 30+ languages & platforms
Node.js

Transition from Http.PTextSb to Http.HttpSb

Provides instructions for replacing deprecated PTextSb method calls with HttpSb.

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 sbRequestBody = new chilkat.StringBuilder();
    sbRequestBody.Append("This is the HTTP request body");
    var charset = "utf-8";
    var contentType = "text/plain";

    //  ------------------------------------------------------------------------
    //  The PTextSb method is deprecated:

    // responseObj: HttpResponse
    var responseObj = http.PTextSb(verb,url,sbRequestBody,charset,contentType,false,false);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using HttpSb.
    //  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.HttpSb(verb,url,sbRequestBody,charset,contentType,responseOut);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }


}

chilkatExample();