You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

postman-collection

Package Overview
Dependencies
Maintainers
6
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.6 to 3.4.7-beta.1

64

lib/collection/request-body.js
var _ = require('../util').lodash,
PropertyBase = require('./property-base').PropertyBase,
PropertyList = require('./property-list').PropertyList,
VariableList = require('./variable-list').VariableList,
QueryParam = require('./query-param').QueryParam,

@@ -41,6 +42,7 @@ FormParam = require('./form-param').FormParam,

var mode = RequestBody.MODES[options.mode.toString().toLowerCase()] || RequestBody.MODES.raw,
raw = options.raw,
urlencoded = options.urlencoded,
transform = options.transform,
formdata = options.formdata,
file = options.file;
file = options.file,
raw = options.raw;

@@ -50,6 +52,3 @@ // Handle URL Encoded data

_.isString(options.urlencoded) && (urlencoded = QueryParam.parse(options.urlencoded));
// @todo: The fallback in the ternary expression will never be hit, as urlencoded points to
// @todo: options.urlencoded
urlencoded = urlencoded ? new PropertyList(QueryParam, this, urlencoded) :
new PropertyList(QueryParam, this, []);
urlencoded = new PropertyList(QueryParam, this, urlencoded);
}

@@ -59,10 +58,25 @@

if (options.formdata) {
// @todo: The fallback in the ternary expression will never be hit, as formdata points to
// @todo: options.formdata
formdata = formdata ? new PropertyList(FormParam, this, options.formdata) :
new PropertyList(FormParam, this, []);
formdata = new PropertyList(FormParam, this, formdata);
}
_.isString(options.file) && (file = { src: file });
// Handle File
if (_.isString(options.file)) {
// @todo Variable#type file ?
file = { src: options.file };
}
// Handle Transform mode data
// @todo add tests
if (options.transform) {
transform = {
// @todo bail out if type is empty?
type: transform.type,
version: transform.version,
content: transform.content || EMPTY,
params: transform.params || {},
// @todo add Variable#type `file`
resources: new VariableList(this, transform.resources || [])
};
}
// If mode is raw but options does not give raw content, set it to empty string

@@ -117,2 +131,9 @@ (mode === RequestBody.MODES.raw && !raw) && (raw = '');

/**
* Transform data properties for this request are held in this field.
*
* @type {Object}
*/
transform: transform,
/**
* Indicates whether to include body in request or not.

@@ -135,5 +156,10 @@ *

if (this.mode === RequestBody.MODES.formdata || this.mode === RequestBody.MODES.file) {
// @todo: implement this, check if we need to return undefined or something.
// @todo formdata structure is predictable (boundary, part headers)
// @todo for files, clone ReadStream?
return EMPTY;
}
// Transform. @formdata Am I a Joke To You? (;-_-)
if (this.mode === RequestBody.MODES.transform) {
return EMPTY;
}
if (this.mode === RequestBody.MODES.urlencoded) {

@@ -159,7 +185,12 @@ return PropertyList.isPropertyList(this.urlencoded) ? QueryParam.unparse(this.urlencoded.all()) :

// Handle file mode.
if (mode === RequestBody.MODES.file) {
// Handle file mode.
return !(data && (data.src || data.content));
}
// Handle transform mode.
if (mode === RequestBody.MODES.transform) {
return !(data && data.type);
}
return !data || !(_.isString(data) ? data.length : (_.isFunction(data.count) && data.count()));

@@ -182,6 +213,7 @@ }

MODES: {
file: 'file',
formdata: 'formdata',
raw: 'raw',
formdata: 'formdata',
urlencoded: 'urlencoded',
file: 'file'
transform: 'transform',
urlencoded: 'urlencoded'
}

@@ -188,0 +220,0 @@ });

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

"author": "Postman Labs <help@getpostman.com>",
"version": "3.4.6",
"version": "3.4.7-beta.1",
"keywords": [

@@ -46,3 +46,3 @@ "postman"

"sanitize-html": "1.20.0",
"semver": "5.6.0",
"semver": "6.0.0",
"uuid": "3.3.2"

@@ -58,3 +58,3 @@ },

"eslint": "5.15.3",
"eslint-plugin-jsdoc": "4.4.2",
"eslint-plugin-jsdoc": "4.5.0",
"eslint-plugin-lodash": "5.1.0",

@@ -64,3 +64,3 @@ "eslint-plugin-mocha": "5.3.0",

"istanbul": "0.4.5",
"js-yaml": "3.12.2",
"js-yaml": "3.13.0",
"jsdoc": "3.5.5",

@@ -67,0 +67,0 @@ "jsdoc-to-markdown": "4.0.1",

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