Socket
Socket
Sign inDemoInstall

http-browserify

Package Overview
Dependencies
2
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.7.0

LICENSE

9

lib/request.js

@@ -145,2 +145,5 @@ var Stream = require('stream');

}
else if (isXHR2Compatible(this.body[0])) {
this.xhr.send(this.body[0]);
}
else {

@@ -202,1 +205,7 @@ var body = '';

};
var isXHR2Compatible = function (obj) {
if (typeof Blob !== 'undefined' && obj instanceof Blob) return true;
if (typeof ArrayBuffer !== 'undefined' && obj instanceof ArrayBuffer) return true;
if (typeof FormData !== 'undefined' && obj instanceof FormData) return true;
};

2

package.json
{
"name": "http-browserify",
"version": "1.6.0",
"version": "1.7.0",
"description": "http module compatability for browserify",

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

@@ -1,11 +0,10 @@

global.window = {
location: {
global.window = global;
global.location = {
host: 'localhost:8081',
port: 8081,
protocol: 'http:'
}
};
var noop = function() {};
global.window.XMLHttpRequest = function() {
global.XMLHttpRequest = function() {
this.open = noop;

@@ -15,2 +14,6 @@ this.send = noop;

global.FormData = function () {};
global.Blob = function () {};
global.ArrayBuffer = function () {};
var test = require('tape').test;

@@ -90,1 +93,24 @@ var http = require('../index.js');

});
test('Test POST XHR2 types', function(t) {
t.plan(3);
var url = '/api/foo';
var request = http.request({ url: url, method: 'POST' }, noop);
request.xhr.send = function (data) {
t.ok(data instanceof global.ArrayBuffer, 'data should be instanceof ArrayBuffer');
};
request.end(new global.ArrayBuffer());
request = http.request({ url: url, method: 'POST' }, noop);
request.xhr.send = function (data) {
t.ok(data instanceof global.Blob, 'data should be instanceof Blob');
};
request.end(new global.Blob());
request = http.request({ url: url, method: 'POST' }, noop);
request.xhr.send = function (data) {
t.ok(data instanceof global.FormData, 'data should be instanceof FormData');
};
request.end(new global.FormData());
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc