Package Exports
- http-request-plus
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-request-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
http-request-plus 
Small wrapper around {http,https}.request()
Features:
- HTTP & HTTPs
- promise oriented
- stream oriented
- cancelable
- request
bodycan be either a buffer/string or a stream - content length header automatically set if available
- request
queryif provided as object
Install
Installation of the npm package:
> npm install --save http-request-plusUsage
Example
Easiest use case: just downloads and prints a page with error handling.
ES2015 - ES2016:
import httpRequestPlus from 'http-request-plus'
(async () => {
try {
console.log(
await httpRequestPlus('http://example.org').readAll('utf8')
)
} catch (error) {
console.error('An error as occured', error)
}
})()ES5:
var httpRequestPlus = require('http-request-plus').default
httpRequestPlus('http://example.org').readAll('utf8')
.then(body => {
console.log(body)
})
.catch(error => {
console.error('An error as occured', error)
})httpRequestPlus(options...) → Promise<response>
Promise<response>.cancel()
Promise<response>.readAll() → Promise<buffer>
Promise<response>.request
response.cancel()
response.readAll() → Promise<buffer>
response.length
error.code
error.response
Development
# Install dependencies
> npm install
# Run the tests
> npm test
# Continuously compile
> npm run dev
# Continuously run the tests
> npm run dev-test
# Build for production (automatically called by npm install)
> npm run buildContributions
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.
License
ISC © Julien Fontanet