Socket
Socket
Sign inDemoInstall

promise-request

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-request

Node.js promise wrapped http request micro library


Version published
Maintainers
1
Created
Source

Promise based request

A Node.js promise wrapped http request micro library

This little lib offers a Promise wrapped http(s).request method.

Usage

var request = require('./promise-request');

var config = {
    scheme: 'https',
    host: 'api.twitter.com',
    path: '/1.1/statuses/mentions_timeline.json',
    method: 'GET'
};

request(config).then(function(result) {
    // do something on success...
}, function(error) {
    console.error(error);
});

Parameters:

  • options:
    • scheme: [string] http or https. Default: http
    • serialize: [function] will be executed on request body. Default: JSON.stringify()
    • deserialize: [function] will be executed on response body. Default: JSON.parse()
    • ... more: see https://nodejs.org/api/http.html#http_http_request_options_callback
  • body: object to send as the request body. options.serialize will be applied on it.

Tests

You'll need mocha to run the tests. Once installed, simply run mocha in the project root directory.

FAQs

Package last updated on 24 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc