postman-collection
Advanced tools
Comparing version 3.6.0-beta.1 to 3.6.0-beta.2
@@ -9,2 +9,3 @@ var _ = require('../util').lodash, | ||
E = '', | ||
AMPERSAND = '&', | ||
@@ -159,2 +160,3 @@ STRING = 'string', | ||
var str, | ||
firstEnabledParam = true, | ||
encode = options && options.encode, | ||
@@ -176,4 +178,10 @@ ignoreDisabled = options && options.ignoreDisabled; | ||
// If the current unparsed result is non empty, append an ampersand | ||
result && (result += AMPERSAND); | ||
// don't add '&' for the very first enabled param | ||
if (firstEnabledParam) { | ||
firstEnabledParam = false; | ||
} | ||
// add '&' before concatenating param | ||
else { | ||
result += AMPERSAND; | ||
} | ||
@@ -201,22 +209,17 @@ return result + QueryParam.unparseSingle(param, encode); | ||
var key = obj.key, | ||
value = obj.value; | ||
value = obj.value, | ||
result; | ||
if (value === undefined) { | ||
return EMPTY; | ||
if (typeof key === STRING) { | ||
result = encode ? encodeQueryParam(key) : key; | ||
} | ||
if (key === null) { | ||
key = EMPTY; | ||
else { | ||
result = E; | ||
} | ||
if (value === null) { | ||
return encode ? encodeQueryParam(key) : key; | ||
if (typeof value === STRING) { | ||
result += EQUALS + (encode ? encodeQueryParam(value) : value); | ||
} | ||
if (encode) { | ||
key = encodeQueryParam(key); | ||
value = encodeQueryParam(value); | ||
} | ||
return key + EQUALS + value; | ||
return result; | ||
} | ||
@@ -223,0 +226,0 @@ }); |
@@ -10,2 +10,4 @@ var _ = require('../util').lodash, | ||
OBJECT = 'object', | ||
STRING = 'string', | ||
FUNCTION = 'function', | ||
PROTOCOL_HTTPS = 'https', | ||
@@ -121,3 +123,3 @@ PROTOCOL_HTTP = 'http', | ||
*/ | ||
port: port || undefined, | ||
port: port, | ||
@@ -132,3 +134,3 @@ /** | ||
*/ | ||
hash: hash || undefined, | ||
hash: hash, | ||
@@ -142,2 +144,6 @@ /** | ||
* @type {PropertyList<QueryParam>} | ||
* | ||
* @todo consider setting this as undefined in v4 otherwise it's | ||
* difficult to detect URL like `localhost/?`. | ||
* currently it's replying upon a single member with empty key. | ||
*/ | ||
@@ -198,3 +204,4 @@ query: new PropertyList(QueryParam, this, query || []), | ||
protocol = this.protocol, | ||
queryString; | ||
queryString, | ||
authString; | ||
@@ -207,6 +214,16 @@ forceProtocol && !protocol && (protocol = DEFAULT_PROTOCOL); | ||
if (this.auth && this.auth.user) { // If the user is not specified, ignore the password. | ||
rawUrl = rawUrl + ((this.auth.password) ? | ||
// ==> username:password@ | ||
this.auth.user + AUTH_SEPARATOR + this.auth.password : this.auth.user) + AUTH_CREDENTIALS_SEPARATOR; | ||
if (this.auth) { | ||
if (typeof this.auth.user === STRING) { | ||
authString = this.auth.user; | ||
} | ||
if (typeof this.auth.password === STRING) { | ||
!authString && (authString = E); | ||
authString += AUTH_SEPARATOR + this.auth.password; | ||
} | ||
if (typeof authString === STRING) { | ||
rawUrl += authString + AUTH_CREDENTIALS_SEPARATOR; | ||
} | ||
} | ||
@@ -218,3 +235,3 @@ | ||
if (this.port) { | ||
if (typeof _.get(this.port, 'toString') === FUNCTION) { | ||
rawUrl += PORT_SEPARATOR + this.port.toString(); | ||
@@ -229,6 +246,19 @@ } | ||
queryString = this.getQueryString({ ignoreDisabled: true }); | ||
queryString && (rawUrl += QUERY_SEPARATOR + queryString); | ||
// either all the params are disabled or a single param is like { key: '' } (http://localhost?) | ||
// in that case, query separator ? must be included in the raw URL. | ||
// @todo return undefined or string from getQueryString method to distinguish | ||
// no params vs empty param. | ||
if (queryString === E) { | ||
// check if there's any enabled param, if so, set queryString to empty string | ||
// otherwise (all disabled), it will be set as undefined | ||
queryString = this.query.find(function (param) { return !(param && param.disabled); }) && E; | ||
} | ||
if (typeof queryString === STRING) { | ||
rawUrl += QUERY_SEPARATOR + queryString; | ||
} | ||
} | ||
if (this.hash) { | ||
if (typeof this.hash === STRING) { | ||
rawUrl += SEARCH_SEPARATOR + this.hash; | ||
@@ -235,0 +265,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "Postman Labs <help@getpostman.com>", | ||
"version": "3.6.0-beta.1", | ||
"version": "3.6.0-beta.2", | ||
"keywords": [ | ||
@@ -48,3 +48,3 @@ "postman" | ||
"sanitize-html": "1.20.1", | ||
"semver": "7.1.2", | ||
"semver": "7.1.3", | ||
"uuid": "3.4.0" | ||
@@ -51,0 +51,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
540008
11724
+ Addedsemver@7.1.3(transitive)
- Removedsemver@7.1.2(transitive)
Updatedsemver@7.1.3