Socket
Socket
Sign inDemoInstall

needle

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

needle - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

test/mimetype.js

2

lib/auth.js

@@ -35,3 +35,3 @@ var createHash = require('crypto').createHash;

var challenge = {},
matches = header.match(/([a-z0-9_-]+)="?([a-z0-9=\/\.@\s-\+)()]+)"?/gi);
matches = header.match(/([a-z0-9_-]+)="?([a-z0-9_=\/\.@\s-\+)()]+)"?/gi);

@@ -38,0 +38,0 @@ for (var i = 0, l = matches.length; i < l; i++) {

@@ -553,4 +553,5 @@ //////////////////////////////////////////

debug('Redirecting to ' + url.resolve(uri, headers.location));
return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback);
var redirect_url = new url.URL(headers.location, uri);
debug('Redirecting to ' + redirect_url.toString());
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
} else if (config.follow_max > 0) {

@@ -579,3 +580,3 @@ return done(new Error('Max redirects reached. Possible loop in: ' + headers.location));

mime = parse_content_type(headers['content-type']),
text_response = mime.type && mime.type.indexOf('text/') != -1;
text_response = mime.type && (mime.type.indexOf('text/') != -1 || !!mime.type.match(/(\/|\+)(xml|json)$/));

@@ -610,6 +611,6 @@ // To start, if our body is compressed and we're able to inflate it, do it.

// decoding non UTF-8 bodies to UTF-8, using the iconv-lite library.
} else if (text_response && config.decode_response
&& mime.charset) {
pipeline.push(decoder(mime.charset));
} else if (text_response && config.decode_response && mime.charset) {
pipeline.push(decoder(mime.charset));
}
// And `out` is the stream we finally push the decoded/parsed output to.

@@ -619,6 +620,4 @@ pipeline.push(out);

// Now, release the kraken!
var tmp = resp;
while (pipeline.length) {
tmp = tmp.pipe(pipeline.shift());
}
function pipelineCb(err) { if (err) debug(err) }
stream.pipeline.apply(null, [resp].concat(pipeline).concat(pipelineCb));

@@ -664,3 +663,2 @@ // If the user has requested and output file, pipe the output stream to it.

var clean_pipe = new stream.PassThrough();
resp.pipe(clean_pipe);

@@ -675,2 +673,6 @@ clean_pipe.on('readable', function() {

stream.pipeline(resp, clean_pipe, function(err) {
if (err) debug(err);
});
// Listen on the 'readable' event to aggregate the chunks, but only if

@@ -763,3 +765,5 @@ // file output wasn't requested. Otherwise we'd have two stream readers.

if (is_stream(post_data)) {
post_data.pipe(request);
stream.pipeline(post_data, request, function(err) {
if (err) debug(err);
});
} else {

@@ -766,0 +770,0 @@ request.write(post_data, config.encoding);

{
"name": "needle",
"version": "2.8.0",
"version": "2.9.0",
"description": "The leanest and most handsome HTTP client in the Nodelands.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -49,3 +49,3 @@ var should = require('should'),

should.not.exist(err);
body.should.be.an.instanceof(Buffer)
body.should.be.an.instanceof(String)
body.toString().should.eql('{"foo":"bar"}');

@@ -145,3 +145,3 @@

should.not.exist(err);
body.should.be.an.instanceof(Buffer)
body.should.be.an.instanceof(String)
body.toString().should.eql('{"foo":"bar"}');

@@ -167,3 +167,3 @@ done();

should.not.exist(err);
body.should.be.an.instanceof(Buffer)
body.should.be.an.instanceof(String)
body.toString().should.eql('{"foo":"bar"}');

@@ -287,3 +287,3 @@ done();

should.not.exist(err);
body.should.be.an.instanceof(Buffer)
body.should.be.an.instanceof(String)
body.toString().should.eql('false');

@@ -301,3 +301,3 @@ done();

should.not.exist(err);
body.should.be.an.instanceof(Buffer)
body.should.be.an.instanceof(String)
body.toString().should.eql('false');

@@ -304,0 +304,0 @@ done();

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