Socket
Socket
Sign inDemoInstall

postman-url-encoder

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-url-encoder - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

12

index.js

@@ -36,2 +36,4 @@ /**

DEFAULT_PROTOCOL = 'http',
LEFT_SQUARE_BRACKET = '[',
RIGHT_SQUARE_BRACKET = ']',

@@ -262,3 +264,3 @@ PATH_SEPARATOR = '/',

// #host, #hostname
nodeUrl.host = nodeUrl.hostname = encoder.encodeHost(hostname); // @note always encode hostname
nodeUrl.host = nodeUrl.hostname = hostname = encoder.encodeHost(hostname); // @note always encode hostname

@@ -307,2 +309,10 @@ // #href = protocol://user:password@host.name

// Finally apply Node.js shenanigans
// # Remove square brackets from IPv6 #hostname
// Refer: https://github.com/nodejs/node/blob/v12.18.3/lib/url.js#L399
// Refer: https://github.com/nodejs/node/blob/v12.18.3/lib/internal/url.js#L1273
if (hostname[0] === LEFT_SQUARE_BRACKET && hostname[hostname.length - 1] === RIGHT_SQUARE_BRACKET) {
nodeUrl.hostname = hostname.slice(1, -1);
}
return nodeUrl;

@@ -309,0 +319,0 @@ }

6

package.json

@@ -5,3 +5,3 @@ {

"author": "Postman Labs <help@getpostman.com>",
"version": "2.1.2",
"version": "2.1.3",
"license": "Apache-2.0",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"postman-collection": "^3.6.3",
"postman-collection": "^3.6.4",
"punycode": "^2.1.1"

@@ -45,3 +45,3 @@ },

"eslint-plugin-security": "^1.4.0",
"jsdoc": "^3.6.3",
"jsdoc": "^3.6.5",
"mocha": "^7.2.0",

@@ -48,0 +48,0 @@ "nyc": "^14.1.1",

@@ -86,3 +86,7 @@ const fs = require('fs'),

'http://192.168.0.1:8080',
'http://192.168.0.1'
'http://192.168.0.1',
'http://[2a03:2880:f12f:183:face:b00c:0:25de]/index.html',
'http://[::1]',
'http://[::1]:3000',
'http://[]:1234'
].forEach(function (url) {

@@ -379,2 +383,16 @@ expect(NodeUrl.parse(url), url).to.deep.include(toNodeUrl(url));

it('should remove square brackets from IPv6 hostname', function () {
expect(toNodeUrl('[::1]')).to.include({
host: '[::1]',
hostname: '::1',
href: 'http://[::1]/'
});
expect(toNodeUrl('[::1]:3000')).to.include({
host: '[::1]:3000',
hostname: '::1',
href: 'http://[::1]:3000/'
});
});
it('should not double encode hostname', function () {

@@ -381,0 +399,0 @@ expect(toNodeUrl('xn--48jwgn17gdel797d.com')).to.include({

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc