Socket
Socket
Sign inDemoInstall

postman-collection

Package Overview
Dependencies
Maintainers
5
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-collection - npm Package Compare versions

Comparing version 4.4.0 to 4.4.1

68

lib/collection/response.js

@@ -201,3 +201,3 @@ var util = require('../util'),

// @todo this temporarily doubles the memory footprint (options.stream + generated buffer).
var stream = normalizeStream(options.stream);
const stream = normalizeStream(options.stream);

@@ -259,3 +259,9 @@ _.mergeDefined((this._details = _.clone(httpReasons.lookup(options.code))), {

*/
responseSize: stream && stream.byteLength
responseSize: stream && stream.byteLength,
/**
* @private
* @type {Number}
*/
downloadedBytes: options.downloadedBytes
});

@@ -402,9 +408,15 @@ }

/**
* Get the response size by computing the same from content length header or using the actual response body.
* @typedef Response.sizeInfo
* @property {Number} body - size of the response body in bytes
* @property {Number} header - size of the response header in bytes
* @property {Number} total - total size of the response body and header in bytes
*/
/**
* Get the response size by computing the same from content length header or
* using the actual response body.
*
* @returns {Number}
* @todo write unit tests
* @returns {Response.sizeInfo} - Response size object
*/
size: function () {
var sizeInfo = {
const sizeInfo = {
body: 0,

@@ -414,31 +426,20 @@ header: 0,

},
contentLength = this.headers.get(CONTENT_LENGTH);
contentEncoding = this.headers.get(CONTENT_ENCODING),
contentLength = this.headers.get(CONTENT_LENGTH),
isCompressed = false,
byteLength;
// if server sent encoded data, we should first try deriving length from headers
if (_.isString(contentEncoding)) {
// desensitise case of content encoding
contentEncoding = contentEncoding.toLowerCase();
// eslint-disable-next-line lodash/prefer-includes
isCompressed = (contentEncoding.indexOf('gzip') > -1) || (contentEncoding.indexOf('deflate') > -1);
// Set body size from downloadedBytes if available
if (util.isNumeric(this.downloadedBytes)) {
sizeInfo.body = this.downloadedBytes;
}
// if 'Content-Length' header is present and encoding is of type gzip/deflate, we take body as declared by
// server. else we need to compute the same.
if (contentLength && isCompressed && util.isNumeric(contentLength)) {
// Rely on content-length header
else if (contentLength && util.isNumeric(contentLength)) {
sizeInfo.body = _.parseInt(contentLength, 10);
}
// if there is a stream defined which looks like buffer, use it's data and move on
else if (this.stream) {
byteLength = this.stream.byteLength;
sizeInfo.body = util.isNumeric(byteLength) ? byteLength :
/* istanbul ignore next */
0;
// Fall back to stream if available
else if (this.stream && util.isNumeric(this.stream.byteLength)) {
sizeInfo.body = this.stream.byteLength;
}
// otherwise, if body is defined, we try get the true length of the body
// Or, calculate size from body string
else if (!_.isNil(this.body)) {
sizeInfo.body = supportsBuffer ? Buffer.byteLength(this.body.toString()) :
sizeInfo.body = supportsBuffer ?
Buffer.byteLength(this.body.toString()) :
/* istanbul ignore next */

@@ -448,3 +449,3 @@ this.body.toString().length;

// size of header is added
// Header size is calculated as per the HTTP message format
// https://tools.ietf.org/html/rfc7230#section-3

@@ -456,6 +457,7 @@ // HTTP-message = start-line (request-line / status-line)

// status-line = HTTP-version SP status-code SP reason-phrase CRLF
sizeInfo.header = (HTTP_X_X + SP + this.code + SP + this.reason() + CRLF + CRLF).length +
this.headers.contentSize();
sizeInfo.header = (
HTTP_X_X + SP + this.code + SP + this.reason() + CRLF + CRLF
).length + this.headers.contentSize();
// compute the approximate total body size by adding size of header and body
// Compute the approximate total body size by adding size of header and body
sizeInfo.total = (sizeInfo.body || 0) + (sizeInfo.header);

@@ -462,0 +464,0 @@

@@ -29,2 +29,3 @@ var _ = require('../util').lodash,

* @property {String} [name] A name of the scope
* @property {String} [prefix] A prefix to be used for variable names in this scope
* @property {Array.<Variable.definition>} [values] A list of variables defined in an array in form of `{name:String,

@@ -115,2 +116,6 @@ * value:String}`

}
if (definition && definition.prefix) {
this.prefix = definition.prefix;
}
}), Property);

@@ -181,3 +186,4 @@

has: function (key) {
var variable = this.values.oneNormalizedVariable(key),
const _key = (this.prefix || '') + key;
var variable = this.values.oneNormalizedVariable(_key),
i,

@@ -190,3 +196,3 @@ ii;

for (i = 0, ii = this._layers.length; i < ii; i++) {
variable = this._layers[i].oneNormalizedVariable(key);
variable = this._layers[i].oneNormalizedVariable(_key);
if (variable && variable.disabled !== true) { break; }

@@ -206,3 +212,4 @@ }

get: function (key) {
var variable = this.values.oneNormalizedVariable(key),
const _key = (this.prefix || '') + key;
var variable = this.values.oneNormalizedVariable(_key),
i,

@@ -214,3 +221,3 @@ ii;

for (i = 0, ii = this._layers.length; i < ii; i++) {
variable = this._layers[i].oneNormalizedVariable(key);
variable = this._layers[i].oneNormalizedVariable(_key);
if (variable && variable.disabled !== true) { break; }

@@ -231,6 +238,7 @@ }

set: function (key, value, type) {
var variable = this.values.oneNormalizedVariable(key),
const _key = (this.prefix || '') + key;
var variable = this.values.oneNormalizedVariable(_key),
// create an object that will be used as setter
update = { key, value };
update = { key: _key, value: value };

@@ -258,2 +266,3 @@ _.isString(type) && (update.type = type);

unset: function (key) {
const _key = (this.prefix || '') + key;
var lastDisabledVariable;

@@ -263,3 +272,3 @@

// bail out if variable name didn't match
if (variable.key !== key) {
if (variable.key !== _key) {
return false;

@@ -281,3 +290,3 @@ }

if (lastDisabledVariable) {
this.values.reference[key] = lastDisabledVariable;
this.values.reference[_key] = lastDisabledVariable;
}

@@ -284,0 +293,0 @@

@@ -374,3 +374,10 @@ var faker = require('@faker-js/faker/locale/en'),

description: 'A random avatar image',
generator: faker.image.avatar
generator: () => {
// ref: https://github.com/faker-js/faker/blob/v8.4.1/src/modules/image/index.ts#L61
return faker.random.arrayElement([
// eslint-disable-next-line max-len
`https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/${faker.datatype.number(1249)}.jpg`,
`https://avatars.githubusercontent.com/u/${faker.datatype.number(100000000)}`
]);
}
},

@@ -377,0 +384,0 @@ $randomImageUrl: {

{
"name": "postman-collection",
"version": "4.4.0",
"version": "4.4.1",
"description": "Enables developers to use a unified Postman Collection format Object across projects",

@@ -5,0 +5,0 @@ "author": "Postman Inc.",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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