postman-collection
Advanced tools
Comparing version 3.5.4 to 3.5.5
@@ -235,6 +235,6 @@ var _ = require('../util').lodash, | ||
if (this.authenticate) { | ||
auth = (this.username || E); | ||
auth = encodeURIComponent(this.username || E); | ||
if (this.password) { | ||
auth += (COLON + (this.password || E)); | ||
auth += COLON + encodeURIComponent(this.password); | ||
} | ||
@@ -241,0 +241,0 @@ |
@@ -84,3 +84,3 @@ var util = require('../util'), | ||
*/ | ||
BUFFER = 'Buffer', | ||
BASE64 = 'base64', | ||
@@ -92,2 +92,16 @@ /** | ||
*/ | ||
STREAM_TYPE_BUFFER = 'Buffer', | ||
/** | ||
* @private | ||
* @const | ||
* @type {string} | ||
*/ | ||
STREAM_TYPE_BASE64 = 'Base64', | ||
/** | ||
* @private | ||
* @const | ||
* @type {string} | ||
*/ | ||
FUNCTION = 'function', | ||
@@ -98,2 +112,9 @@ | ||
* @const | ||
* @type {string} | ||
*/ | ||
STRING = 'string', | ||
/** | ||
* @private | ||
* @const | ||
* @type {String} | ||
@@ -148,13 +169,23 @@ */ | ||
/** | ||
* Normalises an input Buffer or buffer.toJSON() into a Buffer or ArrayBuffer. | ||
* Normalizes an input Buffer, Buffer.toJSON() or base64 string into a Buffer or ArrayBuffer. | ||
* | ||
* @private | ||
* @param {Buffer|Object} stream - An instance of Buffer of an object representation of Buffer(Buffer.toJSON()) | ||
* @param {Buffer|Object} stream - An instance of Buffer, Buffer.toJSON(), or Base64 string | ||
* @returns {Buffer|ArrayBuffer|undefined} | ||
*/ | ||
normaliseStream = function (stream) { | ||
if (stream && stream.type === BUFFER && _.isArray(stream.data)) { | ||
normalizeStream = function (stream) { | ||
if (!stream) { return; } | ||
// create buffer from buffer's JSON representation | ||
if (stream.type === STREAM_TYPE_BUFFER && _.isArray(stream.data)) { | ||
// @todo Add tests for Browser environments, where ArrayBuffer is returned instead of Buffer | ||
return typeof Buffer === FUNCTION ? new Buffer(stream.data) : new Uint8Array(stream.data).buffer; | ||
return typeof Buffer === FUNCTION ? Buffer.from(stream.data) : new Uint8Array(stream.data).buffer; | ||
} | ||
// create buffer from base64 string | ||
if (stream.type === STREAM_TYPE_BASE64 && typeof stream.data === STRING) { | ||
return Buffer.from(stream.data, BASE64); | ||
} | ||
// probably it's already of type buffer | ||
return stream; | ||
@@ -196,4 +227,5 @@ }, | ||
update: function (options) { | ||
// options.stream accepts new Buffer() as well as new Buffer().toJSON() | ||
var stream = normaliseStream(options.stream); | ||
// options.stream accepts Buffer, Buffer.toJSON() or base64 string | ||
// @todo this temporarily doubles the memory footprint (options.stream + generated buffer). | ||
var stream = normalizeStream(options.stream); | ||
@@ -238,4 +270,3 @@ _.mergeDefined((this._details = _.clone(httpReasons.lookup(options.code))), { | ||
*/ | ||
stream: options.body && !_.isString(options.body) && _.isObject(options.body) ? | ||
options.body : stream, | ||
stream: (options.body && _.isObject(options.body)) ? options.body : stream, | ||
@@ -272,7 +303,12 @@ /** | ||
/** | ||
* Convert this response into a JSON serialisable object. The _details meta property is omitted. | ||
* Convert this response into a JSON serializable object. The _details meta property is omitted. | ||
* | ||
* @returns {Object} | ||
* | ||
* @todo consider switching to a different response buffer (stream) representation in v4 as Buffer.toJSON | ||
* appears to cause multiple performance issues. | ||
*/ | ||
toJSON: function () { | ||
// @todo benchmark PropertyBase.toJSON, response Buffer.toJSON or _.cloneElement might | ||
// be the bottleneck. | ||
var response = PropertyBase.toJSON(this); | ||
@@ -279,0 +315,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Postman Labs <help@getpostman.com>", | ||
"version": "3.5.4", | ||
"version": "3.5.5", | ||
"keywords": [ | ||
@@ -45,4 +45,4 @@ "postman" | ||
"mime-format": "2.0.0", | ||
"mime-types": "2.1.24", | ||
"postman-url-encoder": "1.0.2", | ||
"mime-types": "2.1.25", | ||
"postman-url-encoder": "1.0.3", | ||
"sanitize-html": "1.20.1", | ||
@@ -63,3 +63,3 @@ "semver": "6.3.0", | ||
"eslint-plugin-lodash": "5.1.0", | ||
"eslint-plugin-mocha": "6.1.1", | ||
"eslint-plugin-mocha": "6.2.2", | ||
"eslint-plugin-security": "1.4.0", | ||
@@ -69,3 +69,3 @@ "istanbul": "0.4.5", | ||
"jsdoc": "3.6.3", | ||
"jsdoc-to-markdown": "5.0.1", | ||
"jsdoc-to-markdown": "5.0.3", | ||
"karma": "3.1.4", | ||
@@ -76,7 +76,7 @@ "karma-browserify": "6.1.0", | ||
"karma-mocha-reporter": "2.2.5", | ||
"mocha": "6.2.1", | ||
"mocha": "6.2.2", | ||
"mustache": "3.1.0", | ||
"parse-gitignore": "1.0.1", | ||
"postman-jsdoc-theme": "0.0.3", | ||
"postman-request": "2.88.1-postman.15", | ||
"postman-request": "2.88.1-postman.16", | ||
"puppeteer": "1.20.0", | ||
@@ -83,0 +83,0 @@ "require-all": "3.0.0", |
Sorry, the diff of this file is not supported yet
528204
11397
+ Addedmime-db@1.42.0(transitive)
+ Addedmime-types@2.1.25(transitive)
+ Addedpostman-url-encoder@1.0.3(transitive)
- Removedmime-db@1.40.0(transitive)
- Removedmime-types@2.1.24(transitive)
- Removedpostman-url-encoder@1.0.2(transitive)
Updatedmime-types@2.1.25
Updatedpostman-url-encoder@1.0.3