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.2.1 to 1.3.0

8

index.js
/*global module, require, global */
var https = require('https'),
http = require('http'),
urlParser = require('url'),

@@ -8,3 +9,8 @@ minimalRequestPromise = function (callOptions, PromiseImplementation) {

return new Promise(function (resolve, reject) {
var req = https.request(callOptions);
var req;
if (callOptions.port === 80 || callOptions.protocol === 'http:') {
req = http.request(callOptions);
} else {
req = https.request(callOptions);
}

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

2

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

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

/*global beforeEach, afterEach, describe, it, expect, require, jasmine */
var fakeRequest = require('fake-http-request'),
underTest = require('../index'),
https = require('https');
https = require('https'),
http = require('http');
describe('Minimal Request Promise', function () {

@@ -9,5 +10,7 @@ 'use strict';

fakeRequest.install();
fakeRequest.install('http');
});
afterEach(function () {
fakeRequest.uninstall();
fakeRequest.uninstall('http');
});

@@ -46,2 +49,7 @@ it('sends the args to the underlying request object', function () {

});
it('uses http for port 80 requests', function () {
underTest({port: 80, body: 'XYZ'});
expect(http.request.calls.length).toBe(1);
expect(https.request.calls.length).toBe(0);
});
['GET', 'POST'].forEach(function (method) {

@@ -95,2 +103,8 @@ describe(method + ' helper', function () {

});
it('uses http for http protocol requests', function () {
helper('http://npmjs.org').then(function () {
expect(http.request.calls.length).toBe(1);
expect(https.request.calls.length).toBe(0);
});
});
it('passes the promise implementation to the request generator', function () {

@@ -97,0 +111,0 @@ var FakeImplementation = function () {

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