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

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.1.1 to 2.1.2

8

lib/needle.js

@@ -171,2 +171,3 @@ //////////////////////////////////////////

}
}

@@ -246,3 +247,3 @@

if (uri.indexOf('@') !== -1) { // url contains user:pass@host, so parse it.
if (uri.match(/[^\/]@/)) { // url contains user:pass@host, so parse it.
var parts = (url.parse(uri).auth || '').split(':');

@@ -713,3 +714,2 @@ options.username = parts[0];

if (post_data) {

@@ -742,4 +742,4 @@ if (is_stream(post_data)) {

if (verb.match(/get|head/) && args.length == 1)
args.splice(1, 0, null); // assume no data if head/get with one argument (options)
if (verb.match(/get|head/) && args.length == 2)
args.splice(1, 0, null); // assume no data if head/get with two args (url, options)

@@ -746,0 +746,0 @@ return new Promise(function(resolve, reject) {

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

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

@@ -149,2 +149,25 @@ var helpers = require('./helpers'),

describe('URL with @ but not username/pass', function() {
it('doesnt send Authorization header', function(done) {
var url = 'localhost:' + port + '/abc/@def/xyz.zip';
needle.get(url, {}, function(err, resp) {
var sent_headers = resp.body.headers;
Object.keys(sent_headers).should.not.containEql('authorization');
done();
})
})
it('sends user:pass headers if passed via options', function(done) {
var url = 'localhost:' + port + '/abc/@def/xyz.zip';
needle.get(url, { username: 'foo' }, function(err, resp) {
var sent_headers = resp.body.headers;
Object.keys(sent_headers).should.containEql('authorization');
sent_headers['authorization'].should.eql('Basic Zm9v')
done();
})
})
})
describe('when username/password are included in URL', function() {

@@ -151,0 +174,0 @@ var opts = { parse: true };

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