@ghegad/request_curl
v1.0.3
Published
request_curl vous permet de d'envoyer des requests avec curl, utile pour les response 403 de cloudfront aussi.
Downloads
5
Readme
request_curl - Simple request using CURL
request_curl vous permet de d'envoyer des requests avec curl, utile pour les response 403 de cloudfront aussi.
Installation
Install my-project with npm
npm i @ghegad/request_curl
Authors
License
Usage/Examples
import request_curl
import {request_curl} from "@ghegad/request_curl";
affiche la reponse
await request_curl(options,function(status,headers,body,err){console.log(body);});
request GET
sans headers
const options = {
url: "https://example.com/",
method: "GET"
};
avec headers
const options = {
url: "https://example.com/",
method: "GET",
headers:{
"Host":"example.com"
}
};
request POST avec data
envoie des data normal
const options = {
url: "https://example.com/",
method: "POST",
data:querystring.stringify({
"key1":"1",
"key2":"2"
})
};
la request json data
const options = {
url: "https://example.com/",
method: "POST",
data_type:"json",
data:{
"key1":"1",
"key2":"2"
}
};
la request formData
const options = {
url: "https://example.com/",
method: "POST",
formData:{
"key1":"1",
"key2":"2"
}
};
proxy
const options = {
url: "https://example.com/",
method: "GET",
proxy : "http://127.0.0.1:8080",
auth : "user:password"
};
ou
const options = {
url: "https://example.com/",
method: "GET",
proxy : "http://user:[email protected]:8080"
};