Package Exports
- teeny-request
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 (teeny-request) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
teeny-request
Like request, but much smaller - and with less options. Uses node-fetch under the hood.
Pop it in where you would use request. Improves load and parse time of modules.
import {teenyRequest as request} from 'teeny-request';
request({uri: 'http://ip.jsontest.com/'}, function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the JSON.
});teenyRequest(options, callback)
Options are limited to the following
- uri
- method, default GET
- headers
- json
- qs
- useQuerystring
request({uri:'http://service.com/upload', method:'POST', json: {key:'value'}}, function(err,httpResponse,body){ /* ... */ })The callback argument gets 3 arguments:
- An error when applicable (usually from http.ClientRequest object)
- An response object with statusCode, a statusMessage, and a body
- The third is the response body (JSON object)
Thanks
Special thanks to billyjacobson for suggesting the name. Please report all bugs to them.