lib/collection/request-body.js
function (options) {
        _.isString(options) && (options = { mode: 'raw', raw: options });
        if (!options.mode) { return; } // need a valid mode @todo raise error?

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

        // Handle URL Encoded data
        if (options.urlencoded) {
            _.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, []);
        }

        // Handle Form data
        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, []);
        }

        // Handle GraphQL data
        if (options.graphql) {
            graphql = {
                query: graphql.query,
                operationName: graphql.operationName,
                variables: graphql.variables
            };
        }

        _.isString(options.file) && (file = { src: file });

        // If mode is raw but options does not give raw content, set it to empty string
        (mode === RequestBody.MODES.raw && !raw) && (raw = '');

        // If mode is urlencoded but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.urlencoded && !urlencoded) && (urlencoded = new PropertyList(QueryParam, this, []));

        // If mode is formdata but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.formdata && !formdata) && (formdata = new PropertyList(FormParam, this, []));

        // If mode is graphql but options does not provide any content, set empty query
        (mode === RequestBody.MODES.graphql && !graphql) && (graphql = {});

        _.assign(this, /** @lends RequestBody.prototype */ {

            /**
             * Indicates the type of request data to use.
             *
             * @type {String}
             */
            mode: mode,

            /**
             * If the request has raw body data associated with it, the data is held in this field.
             *
             * @type {String}
             */
            raw: raw,

            /**
             * Any URL encoded body params go here.
             *
             * @type {PropertyList<QueryParam>}
             */
            urlencoded: urlencoded,

            /**
             * Form data parameters for this request are held in this field.
             *
             * @type {PropertyList<FormParam>}
             */
            formdata: formdata,

            /**
             * Holds a reference to a file which should be read as the RequestBody. It can be a file path (when used
             * with Node) or a unique ID (when used with the browser).
             *
             * @note The reference stored here should be resolved by a resolver function (which should be provided to
             * the Postman Runtime).
             */
            file: file,

            /**
             * If the request has raw graphql data associated with it, the data is held in this field.
             *
             * @type {Object}
             */
            graphql: graphql,

            /**
             * Indicates whether to include body in request or not.
             *
             * @type {Boolean}
             */
            disabled: options.disabled
        });
    }
function (options) {
        _.isString(options) && (options = { mode: 'raw', raw: options });
        if (!options.mode) { return; } // need a valid mode @todo raise error?

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

        // Handle URL Encoded data
        if (options.urlencoded) {
            _.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, []);
        }

        // Handle Form data
        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, []);
        }

        // Handle GraphQL data
        if (options.graphql) {
            graphql = {
                query: graphql.query,
                operationName: graphql.operationName,
                variables: graphql.variables
            };
        }

        _.isString(options.file) && (file = { src: file });

        // If mode is raw but options does not give raw content, set it to empty string
        (mode === RequestBody.MODES.raw && !raw) && (raw = '');

        // If mode is urlencoded but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.urlencoded && !urlencoded) && (urlencoded = new PropertyList(QueryParam, this, []));

        // If mode is formdata but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.formdata && !formdata) && (formdata = new PropertyList(FormParam, this, []));

        // If mode is graphql but options does not provide any content, set empty query
        (mode === RequestBody.MODES.graphql && !graphql) && (graphql = {});

        _.assign(this, /** @lends RequestBody.prototype */ {

            /**
             * Indicates the type of request data to use.
             *
             * @type {String}
             */
            mode: mode,

            /**
             * If the request has raw body data associated with it, the data is held in this field.
             *
             * @type {String}
             */
            raw: raw,

            /**
             * Any URL encoded body params go here.
             *
             * @type {PropertyList<QueryParam>}
             */
            urlencoded: urlencoded,

            /**
             * Form data parameters for this request are held in this field.
             *
             * @type {PropertyList<FormParam>}
             */
            formdata: formdata,

            /**
             * Holds a reference to a file which should be read as the RequestBody. It can be a file path (when used
             * with Node) or a unique ID (when used with the browser).
             *
             * @note The reference stored here should be resolved by a resolver function (which should be provided to
             * the Postman Runtime).
             */
            file: file,

            /**
             * If the request has raw graphql data associated with it, the data is held in this field.
             *
             * @type {Object}
             */
            graphql: graphql,

            /**
             * Indicates whether to include body in request or not.
             *
             * @type {Boolean}
             */
            disabled: options.disabled
        });
    }
function ( options ) { _ . isString ( options ) && ( options = { mode : 'raw' , raw : options } ) ; if ( ! options . mode ) { return ; } // need a valid mode @todo raise error? var mode = RequestBody . MODES [ options . mode . toString ( ) . toLowerCase ( ) ] || RequestBody . MODES . raw , urlencoded = options . urlencoded , formdata = options . formdata , graphql = options . graphql , file = options . file , raw = options . raw ; // Handle URL Encoded data if ( options . urlencoded ) { _ . 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 , [ ] ) ; } // Handle Form data 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 , [ ] ) ; } // Handle GraphQL data if ( options . graphql ) { graphql = { query : graphql . query , operationName : graphql . operationName , variables : graphql . variables } ; } _ . isString ( options . file ) && ( file = { src : file } ) ; // If mode is raw but options does not give raw content, set it to empty string ( mode === RequestBody . MODES . raw && ! raw ) && ( raw = '' ) ; // If mode is urlencoded but options does not provide any content, set it to an empty property list ( mode === RequestBody . MODES . urlencoded && ! urlencoded ) && ( urlencoded = new PropertyList ( QueryParam , this , [ ] ) ) ; // If mode is formdata but options does not provide any content, set it to an empty property list ( mode === RequestBody . MODES . formdata && ! formdata ) && ( formdata = new PropertyList ( FormParam , this , [ ] ) ) ; // If mode is graphql but options does not provide any content, set empty query ( mode === RequestBody . MODES . graphql && ! graphql ) && ( graphql = { } ) ; _ . assign ( this , /** @lends RequestBody.prototype */ { /**
             * Indicates the type of request data to use.
             *
             * @type {String}
             */ mode : mode , /**
             * If the request has raw body data associated with it, the data is held in this field.
             *
             * @type {String}
             */ raw : raw , /**
             * Any URL encoded body params go here.
             *
             * @type {PropertyList<QueryParam>}
             */ urlencoded : urlencoded , /**
             * Form data parameters for this request are held in this field.
             *
             * @type {PropertyList<FormParam>}
             */ formdata : formdata , /**
             * Holds a reference to a file which should be read as the RequestBody. It can be a file path (when used
             * with Node) or a unique ID (when used with the browser).
             *
             * @note The reference stored here should be resolved by a resolver function (which should be provided to
             * the Postman Runtime).
             */ file : file , /**
             * If the request has raw graphql data associated with it, the data is held in this field.
             *
             * @type {Object}
             */ graphql : graphql , /**
             * Indicates whether to include body in request or not.
             *
             * @type {Boolean}
             */ disabled : options . disabled } ) ; }
Set the content of this request data

@param {Object} options
Set the content of this request data