You can use both HTTPS as well as HTTP for your own purposes.
Usage
The module will try to convert the received information into JSON. If it fails output Plain Text.
// Import library
import request from "@surfy/request";
/*
Request Options
*/
let options = {
/*
Full requested URL without queries
*/
url: "https://example.com",
/*
Request Method
Values: "GET" or "POST"
Default "POST"
*/
method: "GET",
/*
Query params
Object or String
Default {}
*/
params: {
firstParam: "firstValue",
secondParam: "secondValue"
},
/*
Authorization header
Default False
*/
auth: "AUTH_STRING",
/*
Additional Headers
Default False
*/
headers: {
"-x-your-header-param": "Some value",
/*
You can override Content-Type
Default "application/json"
*/
"Content-Type": "application/x-www-form-urlencoded"
}
};
/*
Send Request
Result: JSON, String or False if error has occurred
*/
let result = await request(options);