Node.js
Node.js
Example: Http.HttpNoBody method
Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var http = new chilkat.Http();
var resp = new chilkat.HttpResponse();
// Send a DELETE request to https://api.example.com/users/123
var url = "https://api.example.com/users/123";
success = http.HttpNoBody("DELETE",url,resp);
if (success == false) {
console.log(http.LastErrorText);
return;
}
console.log("Response Status Code: " + resp.StatusCode);
console.log("Response body:");
console.log(resp.BodyStr);
}
chilkatExample();