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

requests

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requests - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

35

browser.js

@@ -5,2 +5,4 @@ 'use strict';

, listeners = require('loads')
, send = require('xhr-send')
, hang = require('hang')
, AXO = require('axo');

@@ -76,4 +78,4 @@

this.on('stream', function stream(data) {
if (socket.multipart) return this.emit('data', data);
requests.on('stream', function stream(data) {
if (socket.multipart) return requests.emit('data', data);

@@ -85,10 +87,10 @@ //

//
var chunk = data.slice(this.offset);
this.offset = data.length;
var chunk = data.slice(requests.offset);
requests.offset = data.length;
this.emit('data', chunk);
requests.emit('data', chunk);
});
this.on('end', function cleanup() {
delete Requests.active[this.id];
requests.on('end', function cleanup() {
delete Requests.active[requests.id];
});

@@ -108,5 +110,5 @@

//
this.header('Content-Type', 'text/plain');
requests.header('Content-Type', 'text/plain');
for (what in options.headers) {
this.header(what, options.headers[what]);
requests.header(what, options.headers[what]);
}

@@ -117,3 +119,3 @@

//
if (this.streaming) {
if (requests.streaming) {
if ('string' === typeof options.body) {

@@ -134,6 +136,13 @@ if ('multipart' in socket) {

listeners(socket, this, this.streaming);
this.emit('before', socket);
listeners(socket, requests, requests.streaming);
requests.emit('before', socket);
socket.send(options.body);
send(socket, options.body, hang(function send(err) {
if (err) {
requests.emit('error', err);
requests.emit('end', err);
}
requests.emit('send');
}));
};

@@ -140,0 +149,0 @@

{
"name": "requests",
"version": "0.1.0",
"version": "0.1.1",
"description": "An XHR abstraction that works in browsers and node.js",

@@ -38,3 +38,5 @@ "main": "index.js",

"eventemitter3": "0.1.x",
"loads": "0.0.x"
"hang": "1.0.x",
"loads": "0.0.x",
"xhr-send": "1.0.x"
},

@@ -41,0 +43,0 @@ "devDependencies": {

@@ -82,2 +82,3 @@ # requests

- `before` Emitted before we send the actual request.
- `send` Emitted after we've succesfully started the sending of the data.

@@ -84,0 +85,0 @@ ### requests#destroy

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