Simplified HTTP client with Promise API, every imaginable option but small file size
npm install fettuccine




A simplified HTTP client for Node
* with the Promise API
* and every imaginable option thanks to Request,
* nevertheless, keeping small package size by economical module loading
``javascript
const fettuccine = require('fettuccine');
(async () => {
const response = await fettuccine('https://api.github.com/users/isaacs/repos', {
qs: {sort: 'created'},
json: true
});
response.body[0]; //=> {id: 46883374, name: 'pseudomap', ...}
})();
`
``
npm install fettuccine
`javascript`
const fettuccine = require('fettuccine');
url: string (URL to send a request) Object
options: (used as [Request options][request] with gzip defaulting to true) Promise
Return:
It makes an HTTP or HTTPS request to the given URL.
When the request finishes, it will be fulfilled with the http.IncomingMessage object with the additional [body property][request]:
> response body (String or Buffer, or JSON object if the json option is supplied)
When the request fails, it will be rejected with an error object (usually from http.ClientRequest object).
Alias of [fettuccine()][fettucine].
Set options.method to the method name and call [fettuccine()][fettucine].
`javascript
const fettuccine = require('fettuccine');
// With fettuccine()
(async () => {
await fettuccine('https://awesome-webservice.com/api', {
method: 'POST',
body: imageBuffer
});
console.log('Uploaded an image.')
})();
// With fettuccine.post()
(async () => {
await fettuccine.post('https://awesome-webservice.com/api', {
body: imageBuffer
});
console.log('Uploaded an image.')
})();
`
The Fettuccine` class.
ISC License © 2018 Shinnosuke Watanabe
[request]: https://github.com/request/request#requestoptions-callback
[fettucine]: https://github.com/shinnn/fettuccine#fettuccineurl--options