JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q34540F
  • License MIT

Simplified HTTP(S) client with Promise API, every imaginable option but small file size

Package Exports

  • file-or-stdout

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 (file-or-stdout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fettuccine

NPM version Build Status Coverage Status Dependency Status devDependency Status

A simplified HTTP(S) client for Node

const fettuccine = require('fettuccine');

fettuccine('https://api.github.com/users/isaacs/repos', {
  qs: {sort: 'created'},
  json: true
}).then(response => {
  response.body[0]; //=> {id: 46883374, name: 'pseudomap', ...}
});

Installation

Use npm.

npm install fettuccine

API

const fettuccine = require('fettuccine');

fettuccine(url [, options])

url: String (URL to send a request)
options: Object (used as Request options with gzip defaulting to true)
Return: Object (Promise instance)

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 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).

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 = require('fettuccine');

// With `fettuccine()`
fettuccine('https://awesome-webservice.com/api', {
  method: 'POST',
  body: new Buffer(/* image buffer */)
}).then(() => console.log('Uploaded an image.'));

// With `fettuccine.post()`
fettuccine.post('https://awesome-webservice.com/api', {
  body: new Buffer(/* image buffer */)
}).then(() => console.log('Uploaded an image.'));

fettuccine.Fettuccine([options])

The Fettuccine class.

License

Copyright (c) 2015 - 2016 Shinnosuke Watanabe

Licensed under the MIT License.