-
-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
I need to send a Post request without body.
Also, need to not include content-type header.
I can't do that because I am getting "Operation was aborted by an application callback" error when I am trying to not use POSTFIELDS.
If I use POSTFIELDS as an empty string, then the content-type is set up by default, and I can't prevent it.
I tried both curly and Curl. Any ideas how I could achieve this with node-libcurl?
It works OK with curl itself: I was able to send a request without body and without any content-type.
This is an example with Curl
import { Curl, curly } from "node-libcurl";
const curl = new Curl();
curl.setOpt(Curl.option.VERBOSE, true);
curl.setOpt(Curl.option.USERAGENT, "myuseragent");
curl.setOpt(Curl.option.DEFAULT_PROTOCOL, "https");
curl.setOpt(Curl.option.PATH_AS_IS, true);
curl.setOpt(Curl.option.URL, "yahoo.com");
curl.setOpt(Curl.option.FOLLOWLOCATION, true);
curl.setOpt(Curl.option.POSTREDIR, 0);
curl.setOpt(Curl.option.MAXREDIRS, 10);
curl.setOpt(Curl.option.POST, 1);
curl.on("end", function (statusCode, body, headers) {
console.log(statusCode);
this.close();
});
curl.on("error", function (error) {
console.log(error);
this.close();
});
curl.perform();
Metadata
Metadata
Assignees
Labels
No labels