🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

request

Package Overview
Dependencies
Maintainers
0
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request - npm Package Compare versions

Comparing version

to
1.1.1

._README.md

6

._package.json

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR 2��#�#com.macromates.caret{
column = 30;
line = 11;
Mac OS X  2��ATTR��"�"com.macromates.caret{
column = 20;
line = 3;
}

@@ -125,9 +125,13 @@ var http = require('http')

if (options.callback) options.callback(null, response, options.responseBodyStream);
} else if (options.onResponse) {
options.onResponse(null, response);
} else if (options.callback) {
var buffer = '';
response
.on("data", function (chunk) { buffer += chunk; })
.on("end", function () { options.callback(null, response, buffer); });
} else {
if (options.onResponse) {
options.onResponse(null, response);
}
if (options.callback) {
var buffer = '';
response
.on("data", function (chunk) { buffer += chunk; })
.on("end", function () { options.callback(null, response, buffer); })
;
}
}

@@ -134,0 +138,0 @@ }

{ "name" : "request"
, "description" : "Simplified HTTP request method."
, "description" : "Simplified HTTP request client."
, "tags" : ["http", "simple", "util", "utility"]
, "version" : "1.1.0"
, "version" : "1.1.1"
, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>"

@@ -6,0 +6,0 @@ , "repository" :

@@ -17,10 +17,13 @@ # Request -- Simplified HTTP request method

* `'uri'` - fully qualified uri or a parsed url object from url.parse()
* `'method'` - http method, defaults to GET
* `'headers'` - http headers, defaults to {}
* `'body'` - entity body for POST and PUT requests
* `'client'` - existing http client object (when undefined a new one will be created and assigned to this property so you can keep around a reference to it if you would like use keep-alive on later request)
* '`followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
* '`requestBodyStream` - Stream to read request body chunks from.
* '`responseBodyStream` - Stream to write body chunks to. When set this option will be passed as the last argument to the callback instead of the entire body.
* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()
* `method` - http method, defaults to GET
* `headers` - http headers, defaults to {}
* `body` - entity body for POST and PUT requests
* `client` - existing http client object (when undefined a new one will be created and assigned to this property so you can keep around a reference to it if you would like use keep-alive on later request)
* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.
* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end".
* `encoding` - Encoding to be used on response.setEncoding when buffering the response data.
* `requestBodyStream` - Stream to read request body chunks from.
* `responseBodyStream` - Stream to write body chunks to. When set this option will be passed as the last argument to the callback instead of the entire body.

@@ -27,0 +30,0 @@ The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer.