1.0.3 • Published 2 years ago

@ghegad/request_curl v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

MIT

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:password@127.0.0.1:8080"
};
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago