Node.js
Node.js
Transition from Http.GetHead to Http.HttpNoBody
Provides instructions for replacing deprecated GetHead method calls with HttpNoBody.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var http = new chilkat.Http();
var url = "https://www.example.com/";
// ------------------------------------------------------------------------
// The GetHead method is deprecated:
// resp1: HttpResponse
var resp1 = http.GetHead(url);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp1.StatusCode);
// ------------------------------------------------------------------------
// Do the equivalent using HttpNoBody.
// Your application creates a new, empty response object which is passed
// in the last argument and filled with the HTTP response upon success.
var resp2 = new chilkat.HttpResponse();
success = http.HttpNoBody("HEAD",url,resp2);
if (success == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp2.StatusCode);
}
chilkatExample();