package
Small package that provides a promise-based, stream-oriented wrapper around the http and https modules
npm install http-request-plusGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Small package that provides a promise-based, stream-oriented wrapper around the http and https modules.
Features:
error on timeoutInstallation of the npm package:
> npm install --save http-request-plusEasy use case: just downloads and prints a page with error handling.
ES2015 - ES2016:
import httpRequestPlus from "http-request-plus";
async function main() {
// this is a standard Node's IncomingMessage augmented with the following method:
//
// - buffer(): returns a promise to the content of the response in a Buffer
// - json(): returns a promise to the content of the response parsed as JSON
// - text(): returns a promise to the content of the response parsed as a UTF-8 string
const response = await httpRequestPlus("http://example.org", {
// A request body can provided, either as a buffer/string or a stream
body: "foo bar",
// By default, http-request-plus throws if the reponse's status Code is not 2xx
//
// This option can be used to bypass this
bypassStatusCheck: true,
// Maximum number of redirects that should be handled by http-request-plus
//
// Defaults to 5
maxRedirects:
Contributions are very welcomed, either on the documentation or on the code.
You may:
ISC © Julien Fontanet
marsaud
marsaud.fabrice@neuf.fr
Estimated unpacked size across 5 packages.
1.5 MB
Includes dependencies.