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

minreq

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minreq - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

LICENSE

32

index.js

@@ -39,6 +39,12 @@ var http = require("http"),

this.response = null;
this._body = "";
this._body = new Buffer(0);
if(typeof options.uri !== "object") options.uri = url.parse(options.uri);
if(typeof options.uri === "string"){
options.uri = url.parse(options.uri);
} else if(typeof options.uri !== "object"){
this.emit("error", Error("No URI specified!"));
return;
}
//fix for node < 0.5

@@ -51,7 +57,2 @@ if( !("path" in options.uri) ) options.uri.path = options.uri.pathname;

if(typeof options.uri !== "object"){
this.emit("error", Error("No URI specified!"));
return;
}
if( !(options.uri.protocol in protocols) ){

@@ -108,2 +109,3 @@ this.emit("error", Error("Unknown protocol: " + options.uri.protocol));

if(scope._cb) scope._cb(err);
scope._cb = null; //remove the cb
});

@@ -113,8 +115,12 @@

scope._ended = true;
if(scope._cb) scope._cb(null, scope.response, scope._body);
});
this.on("data", function(chunk){
scope._body += chunk;
});
if(this._cb){
this.on("data", function(chunk){
scope._body = Buffer.concat([scope._body, chunk]);
});
this.on("end", function(){
scope._cb(null, scope.response, scope._body);
});
}

@@ -234,6 +240,2 @@ this.on("redirect", function(location){

};
Request.prototype.then = function(cb){
//for promise-like behavior
this._cb = cb;
};
Request.prototype.abort = function(){

@@ -240,0 +242,0 @@ this._request.abort();

{
"name": "minreq",
"version": "0.1.6",
"version": "0.2.0",
"description": "minimalistic request library",

@@ -5,0 +5,0 @@ "author": "Felix Boehm <me@feedic.com>",

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