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

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.0 to 2.1.1

6

encoder/encode-set.js

@@ -33,3 +33,3 @@ /**

QUERY_ENCODE_CHARS = [' ', '"', '#', '&', '\'', '<', '=', '>'],
QUERY_ENCODE_CHARS = [' ', '"', '#', '\'', '<', '>'],
FRAGMENT_EXTEND_CHARS = [' ', '"', '<', '>', '`'],

@@ -325,7 +325,7 @@ PATH_EXTEND_CHARS = ['#', '?', '{', '}'],

* The query percent-encode set is the C0 control percent-encode set and
* U+0020 SPACE, U+0022 ("), U+0023 (#), U+0026 (&), U+0027 ('), U+003C (<),
* U+003D (=), and U+003E (>).
* U+0020 SPACE, U+0022 ("), U+0023 (#), U+0027 ('), U+003C (<), and U+003E (>).
*
* @const
* @type {EncodeSet}
* @see {@link https://url.spec.whatwg.org/#query-state}
*/

@@ -332,0 +332,0 @@ QUERY_ENCODE_SET = new EncodeSet(QUERY_ENCODE_CHARS).seal();

@@ -63,2 +63,5 @@ /**

PARAM_VALUE_ENCODE_SET = EncodeSet.extend(QUERY_ENCODE_SET, ['&']).seal(),
PARAM_KEY_ENCODE_SET = EncodeSet.extend(QUERY_ENCODE_SET, ['&', '=']).seal(),
E = '',

@@ -203,4 +206,4 @@ EQUALS = '=',

* @example
* // returns 'param%20%22%23%26%27%3C%3D%3E'
* encodeQueryParam('param "#&\'<=>')
* // returns 'param%20%22%23%27%3C%3E'
* encodeQueryParam('param "#\'<>')
*

@@ -227,3 +230,3 @@ * // returns 'foo=bar'

if (typeof key === STRING) {
result = _percentEncode(key, QUERY_ENCODE_SET);
result = _percentEncode(key, PARAM_KEY_ENCODE_SET);
}

@@ -235,3 +238,3 @@ else {

if (typeof value === STRING) {
result += EQUALS + _percentEncode(value, QUERY_ENCODE_SET);
result += EQUALS + _percentEncode(value, PARAM_VALUE_ENCODE_SET);
}

@@ -238,0 +241,0 @@

@@ -209,4 +209,4 @@ /**

if (url.query && url.query.count()) {
queryParams = disableEncoding ? url.getQueryString({ ignoreDisabled: true }) :
encoder.encodeQueryParams(url.query.all());
queryParams = url.getQueryString({ ignoreDisabled: true });
queryParams = disableEncoding ? queryParams : encoder.encodeQueryParam(queryParams);

@@ -213,0 +213,0 @@ // either all the params are disabled or a single param is like { key: '' } (http://localhost?)

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

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

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

"@postman/csv-parse": "^4.0.2",
"async": "^3.1.0",
"async": "^3.1.1",
"bipbip": "^0.4.1",

@@ -43,3 +43,3 @@ "chai": "^4.2.0",

"eslint": "^5.16.0",
"eslint-plugin-jsdoc": "^18.4.4",
"eslint-plugin-jsdoc": "^18.11.0",
"eslint-plugin-security": "^1.4.0",

@@ -46,0 +46,0 @@ "jsdoc": "^3.6.3",

@@ -20,3 +20,3 @@ const expect = require('chai').expect,

it('should percent-encode SPACE, ("), (#), (&), (\'), (<), (=), and (>)', function () {
it('should percent-encode SPACE, ("), (#), (\'), (<), and (>)', function () {
var i,

@@ -26,3 +26,3 @@ char,

chars = [],
expected = [' ', '"', '#', '&', '\'', '<', '=', '>'];
expected = [' ', '"', '#', '\'', '<', '>'];

@@ -29,0 +29,0 @@ for (i = 32; i < 127; i++) {

@@ -139,6 +139,6 @@ const expect = require('chai').expect,

it('should be extend by SPACE, ("), (#), (&), (\'), (<), (=), and (>)', function () {
it('should be extend by SPACE, ("), (#), (\'), (<), and (>)', function () {
var i,
chars = [],
expected = [' ', '"', '#', '&', '\'', '<', '=', '>'];
expected = [' ', '"', '#', '\'', '<', '>'];

@@ -145,0 +145,0 @@ for (i = 32; i < 127; i++) {

@@ -233,3 +233,3 @@ const expect = require('chai').expect,

it('should percent-encode SPACE, ("), (#), (&), (\'), (<), (=), and (>)', function () {
it('should percent-encode SPACE, ("), (#), (\'), (<), and (>)', function () {
var i,

@@ -239,3 +239,3 @@ char,

chars = [],
expected = [' ', '"', '#', '&', '\'', '<', '=', '>'];
expected = [' ', '"', '#', '\'', '<', '>'];

@@ -278,4 +278,44 @@ for (i = 32; i < 127; i++) {

it('should percent-encode SPACE, ("), (#), (&), (\'), (<), (=), and (>) in param key', function () {
var i,
char,
encoded,
chars = [],
expected = [' ', '"', '#', '&', '\'', '<', '=', '>'];
for (i = 32; i < 127; i++) {
char = String.fromCharCode(i);
encoded = encoder.encodeQueryParam({ key: char });
if (char !== encoded) {
chars.push(char);
expect(encoded).to.equal(encoder.percentEncodeCharCode(i));
}
}
expect(chars).to.have.all.members(expected);
});
it('should percent-encode SPACE, ("), (#), (&), (\'), (<), and (>) in param value', function () {
var i,
char,
encoded,
chars = [],
expected = [' ', '"', '#', '&', '\'', '<', '>'];
for (i = 32; i < 127; i++) {
char = String.fromCharCode(i);
encoded = encoder.encodeQueryParam({ value: char }).slice(1); // leading `=`
if (char !== encoded) {
chars.push(char);
expect(encoded).to.equal(encoder.percentEncodeCharCode(i));
}
}
expect(chars).to.have.all.members(expected);
});
it('should handle param object without key', function () {
expect(encoder.encodeQueryParam({ value: 'bar' })).to.eql('=bar');
expect(encoder.encodeQueryParam({ value: 'bar&=#' })).to.eql('=bar%26=%23');
});

@@ -288,3 +328,3 @@

it('should handle param object without value', function () {
expect(encoder.encodeQueryParam({ key: 'foo' })).to.eql('foo');
expect(encoder.encodeQueryParam({ key: 'foo&=#' })).to.eql('foo%26%3D%23');
});

@@ -291,0 +331,0 @@

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

it('should accept url string', function () {
expect(toNodeUrl('cooper@郵便屋さん.com:399/foo&bar/{baz}?q=("foo")#`hash`'))
expect(toNodeUrl('cooper@郵便屋さん.com:399/foo&bar/{baz}?q=("f=o&o")#`hash`'))
.to.eql({

@@ -22,7 +22,7 @@ protocol: 'http:',

hash: '#%60hash%60',
search: '?q=(%22foo%22)',
query: 'q=(%22foo%22)',
search: '?q=(%22f=o&o%22)',
query: 'q=(%22f=o&o%22)',
pathname: '/foo&bar/%7Bbaz%7D',
path: '/foo&bar/%7Bbaz%7D?q=(%22foo%22)',
href: 'http://cooper@xn--48jwgn17gdel797d.com:399/foo&bar/%7Bbaz%7D?q=(%22foo%22)#%60hash%60'
path: '/foo&bar/%7Bbaz%7D?q=(%22f=o&o%22)',
href: 'http://cooper@xn--48jwgn17gdel797d.com:399/foo&bar/%7Bbaz%7D?q=(%22f=o&o%22)#%60hash%60'
});

@@ -29,0 +29,0 @@ });

Sorry, the diff of this file is not supported yet

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