Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minimal-request-promise

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minimal-request-promise - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

15

index.js

@@ -15,2 +15,17 @@ /*global module, require, global */

}
if (callOptions.timeout) {
req.setTimeout(callOptions.timeout, function () {
var e = new Error('ETIMEDOUT');
e.code = 'ETIMEDOUT';
e.errno = 'ETIMEDOUT';
e.syscall = 'connect';
e.address = callOptions.hostname,
e.port = callOptions.port
if (callOptions.resolveErrors) {
resolve(e);
} else {
reject(e);
}
});
}

@@ -17,0 +32,0 @@ req.on('response', function (res) {

2

package.json
{
"name": "minimal-request-promise",
"version": "1.3.0",
"version": "1.4.0",
"description": "A+ Promise interface to Node.js HTTPS request, with no dependencies",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

#Minimal Promise version of HTTPS request
# Minimal Promise version of HTTPS request

@@ -10,3 +10,3 @@ [![Build Status](https://travis-ci.org/gojko/minimal-request-promise.svg?branch=master)](https://travis-ci.org/gojko/minimal-request-promise)

##Installation
## Installation

@@ -21,3 +21,3 @@ Install using NPM:

##Usage
## Usage

@@ -28,6 +28,11 @@ You can use the standard Node [HTTPS Request Options](https://nodejs.org/api/https.html#https_https_request_options_callback), with the following additional options:

* `resolveErrors`: `boolean`, if true, HTTP error response codes will result in a resolved promise (instead of rejected). Only network errors will result in a rejected promise. If false (default), network errors and successful HTTP requests with an error response code will cause the promise to be rejected.
* `timeout`: `number`, Integer containing the number of milliseconds to wait for a
server to send response headers (and start the response body) before aborting
the request. Note that if the underlying TCP connection cannot be established,
the OS-wide TCP connection timeout will overrule the `timeout` option ([the
default in Linux can be anywhere from 20-120 seconds][linux-timeout]).
If you want to execute a FORM POST, remember to add the [`Content-Length` header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13) as well. This library intentionally does not automatically add that, to keep the interface in line with standard Node.JS requests.
##Example
## Example

@@ -64,5 +69,5 @@ ```javascript

##GET and POST method shortcuts
## GET and POST method shortcuts
In addition to using the standard Node.js request parameters, you can also generate basic parameters from URLS for GET and POST using the helper methods. The helper methods are `.get` and `.post`, and they expect the following arguments:
In addition to using the standard Node.js request parameters, you can also generate basic parameters from URLS for GET and POST using the helper methods. The helper methods are `.get` and `.post`, and they expect the following arguments:

@@ -99,3 +104,3 @@ * `url`: `string`, a URL to GET or POST to

##Using with a different Promise library
## Using with a different Promise library

@@ -113,4 +118,4 @@ By default, this library uses the built-in `Promise` from Node.js. If you'd like to use a different A+ Promise library, just pass it in as the second argument. For example:

##License
## License
MIT
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