Package Exports
- http-call
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-call) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
http-call
node utility for simple http calls
API Reference
Classes
- HTTP
Utility for simple HTTP calls
Typedefs
- RequestOptions :
Object
HTTP
Utility for simple HTTP calls
Kind: global class
- HTTP
- instance
- .get(url, options) ⇒
Promise
- .get(url, options) ⇒
- static
- .get(url, options) ⇒
Promise
- .get(url, options) ⇒
- instance
httP.get(url, options) ⇒ Promise
make a simple http request with initialized object use this for setting some defaults
Kind: instance method of HTTP
Param | Type | Description |
---|---|---|
url | string |
url or path to call |
options | RequestOptions |
Example
const HTTP = require('http-call')
let client = new HTTP({headers: 'user-agent': 'my-unique-agent/1.0.0'})
await client.get('https://google.com')
HTTP.get(url, options) ⇒ Promise
make a simple http request
Kind: static method of HTTP
Param | Type | Description |
---|---|---|
url | string |
url or path to call |
options | RequestOptions |
Example
const http = require('http-call')
await http.get('https://google.com')
RequestOptions : Object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
headers | Object.<string, string> |
request headers |
body | string | Object |
request body. Sets content-type to application/json and stringifies when object |
raw | boolean |
do not parse body, instead just return node request object |
requestMiddleware | function |
called just before the request is made, returns a promise |
responseMiddleware | function |
called after a request is made, returns a promise |