@huksley/request
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@huksley/request", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "[gist-sized] Zero dependency, single-file NodeJS 14+ HTTP(s) request module", | ||
@@ -5,0 +5,0 @@ "main": "request.js", |
@@ -1,22 +0,30 @@ | ||
export interface Options { | ||
method?: string; | ||
headers?: { [key: string]: string }; | ||
verbose?: boolean; | ||
/** Default is 10000 */ | ||
timeout?: number; | ||
encoding?: string; | ||
body?: any; | ||
import { IncomingMessage } from "http"; | ||
declare module "./request.js" { | ||
export interface Options { | ||
method?: string; | ||
headers?: { [key: string]: string }; | ||
verbose?: boolean; | ||
/** Default is 10000 */ | ||
timeout?: number; | ||
encoding?: string; | ||
body?: any; | ||
} | ||
export interface Response<T> extends IncomingMessage { | ||
body: T; | ||
} | ||
/** | ||
* Makes HTTP(s) request and returns response with parsed body. | ||
* | ||
* ``` | ||
* const res = await request("https://jsonip.com") | ||
* console.info("Your IP", res.body.ip, "headers", res.headers) | ||
* ``` | ||
* @param {*} url - Absolute URL | ||
* @param {*} options - Options, like in fetch | ||
* @returns {IncomingMessage} Http response with body | ||
*/ | ||
export function request<T>(url: string, options?: Options): T; | ||
} | ||
/** | ||
* Makes HTTP(s) request and returns response with parsed body. | ||
* | ||
* ``` | ||
* const res = await request("https://jsonip.com") | ||
* console.info("Your IP", res.body.ip, "headers", res.headers) | ||
* ``` | ||
* @param {*} url - Absolute URL | ||
* @param {*} options - Options, like in fetch | ||
* @returns {IncomingMessage} Http response with body | ||
*/ | ||
export function request(url: string, options?: Options); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15084
298