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

request

Package Overview
Dependencies
Maintainers
1
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 2.1.0 to 2.1.1

test.js

12

main.js

@@ -264,3 +264,5 @@ // Copyright 2010-2011 Mikeal Rogers

// Hack to emit end on close because of a core bug that never fires end
response.on('close', function () {options.response.emit('end')})
response.on('close', function () {
if (!options._ended) options.response.emit('end')
})

@@ -292,3 +294,6 @@ if (options.encoding) {

response.on("data", function (chunk) {options.emit("data", chunk)})
response.on("end", function (chunk) {options.emit("end", chunk)})
response.on("end", function (chunk) {
options._ended = true
options.emit("end", chunk)
})
response.on("close", function () {options.emit("close")})

@@ -333,3 +338,4 @@

if (isReadStream(src)) {
options.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1))
if (!options.headers['content-type'] && !options.headers['Content-Type'])
options.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1))
} else {

@@ -336,0 +342,0 @@ if (src.headers) {

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

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

@@ -30,3 +30,3 @@ var http = require('http')

if (r !== text) console.log(r, text);
assert.ok(r === text)
assert.equal(r, text)
resp.writeHead(200, {'content-type':'text/plain'})

@@ -33,0 +33,0 @@ resp.write('OK')

@@ -54,3 +54,3 @@ var server = require('./server')

mypulldata.end = function () {
assert.ok(d === 'mypulldata');
assert.equal(d, 'mypulldata');
passes += 1

@@ -66,4 +66,4 @@ check();

} else if (req.method === "PUT") {
assert.ok(req.headers['content-type'] === 'text/plain-test');
assert.ok(req.headers['content-length'] == 4)
assert.equal(req.headers['content-type'], 'text/plain-test');
assert.equal(req.headers['content-length'], 4)
var validate = '';

@@ -75,3 +75,3 @@

resp.end();
assert.ok(validate === 'asdf');
assert.equal(validate, 'asdf');
passes += 1;

@@ -84,3 +84,3 @@ check();

if (req.method === "PUT") {
assert.ok(req.headers['content-type'] === 'text/javascript');
assert.equal(req.headers['content-type'], 'text/javascript');
passes += 1;

@@ -112,4 +112,4 @@ check();

request.get('http://localhost:3453/catresp', function (e, resp, body) {
assert.ok(resp.headers['content-type'] === 'text/plain-test');
assert.ok(resp.headers['content-length'] == 4)
assert.equal(resp.headers['content-type'], 'text/plain-test');
assert.equal(resp.headers['content-length'], 4)
passes += 1

@@ -134,3 +134,3 @@ check();

request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) {
assert.ok(resp.headers['x-oneline-proxy'] === 'yup')
assert.equal(resp.headers['x-oneline-proxy'], 'yup')
passes += 1

@@ -137,0 +137,0 @@ check()

@@ -28,3 +28,3 @@ var server = require('./server')

request(shouldTimeout, function (err, resp, body) {
assert.ok(err == "ETIMEDOUT");
assert.equal(err, "ETIMEDOUT");
checkDone();

@@ -41,4 +41,4 @@ })

request(shouldntTimeout, function (err, resp, body) {
assert.ok(!err);
assert.ok(expectedBody === body)
assert.equal(!err);
assert.equal(expectedBody, body)
checkDone();

@@ -53,4 +53,4 @@ })

request(noTimeout, function (err, resp, body) {
assert.ok(!err);
assert.ok(expectedBody === body)
assert.equal(!err);
assert.equal(expectedBody, body)
checkDone();

@@ -66,3 +66,3 @@ })

request(negativeTimeout, function (err, resp, body) {
assert.ok(err == "ETIMEDOUT");
assert.equal(err, "ETIMEDOUT");
checkDone();

@@ -78,3 +78,3 @@ })

request(floatTimeout, function (err, resp, body) {
assert.ok(err == "ETIMEDOUT");
assert.equal(err, "ETIMEDOUT");
checkDone();

@@ -81,0 +81,0 @@ })

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