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
const fettuccine = ; async { const response = await ; responsebody0; //=> {id: 46883374, name: 'pseudomap', ...}};
Installation
npm install fettuccine
API
const fettuccine = ;
fettuccine(url [, options])
url: string
(URL to send a request)
options: Object
(used as Request
options with gzip
defaulting to true
)
Return: Promise<Object>
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:
response
body (String
orBuffer
, or JSON object if thejson
option is supplied)
When the request fails, it will be rejected with an error object (usually from http.ClientRequest
object).
fettuccine.get()
Alias of fettuccine()
.
fettuccine.post(), fettuccine.put(), fettuccine.patch(), fettuccine.head(), fettuccine.delete()
Set options.method
to the method name and call fettuccine()
.
const fettuccine = ; // With `fettuccine()`async { await ; console}; // With `fettuccine.post()`async { await fettuccine; console};
fettuccine.Fettuccine([options])
The Fettuccine
class.
License
ISC License © 2018 Shinnosuke Watanabe