lib/requester/core.js
function (request, protocolProfileBehavior) {
        if (!(request && request.body)) {
            return;
        }

        var requestBody = request.body,
            requestBodyType = requestBody.mode,
            requestMethod = (typeof request.method === 'string') ? request.method.toLowerCase() : undefined,
            bodyIsEmpty = requestBody.isEmpty(),
            bodyIsDisabled = requestBody.disabled,
            bodyContent = requestBody[requestBodyType],

            // flag to decide body pruning for METHODS_WITHOUT_BODY
            // @note this will be `true` even if protocolProfileBehavior is undefined
            pruneBody = protocolProfileBehavior ? !protocolProfileBehavior.disableBodyPruning : true;

        // early bailout for empty or disabled body (this area has some legacy shenanigans)
        if (bodyIsEmpty || bodyIsDisabled) {
            return;
        }

        // bail out if request method doesn't support body and pruneBody is true.
        if (METHODS_WITHOUT_BODY[requestMethod] && pruneBody) {
            return;
        }

        // even if body is not empty, but the body type is not known, we do not know how to parse the same
        //
        // @note if you'd like to support additional body types beyond formdata, url-encoding, etc, add the same to
        //       the builder module
        if (!requestBodyBuilders.hasOwnProperty(requestBodyType)) {
            return;
        }

        return requestBodyBuilders[requestBodyType](bodyContent, request);
    }
function (request, protocolProfileBehavior) {
        if (!(request && request.body)) {
            return;
        }

        var requestBody = request.body,
            requestBodyType = requestBody.mode,
            requestMethod = (typeof request.method === 'string') ? request.method.toLowerCase() : undefined,
            bodyIsEmpty = requestBody.isEmpty(),
            bodyIsDisabled = requestBody.disabled,
            bodyContent = requestBody[requestBodyType],

            // flag to decide body pruning for METHODS_WITHOUT_BODY
            // @note this will be `true` even if protocolProfileBehavior is undefined
            pruneBody = protocolProfileBehavior ? !protocolProfileBehavior.disableBodyPruning : true;

        // early bailout for empty or disabled body (this area has some legacy shenanigans)
        if (bodyIsEmpty || bodyIsDisabled) {
            return;
        }

        // bail out if request method doesn't support body and pruneBody is true.
        if (METHODS_WITHOUT_BODY[requestMethod] && pruneBody) {
            return;
        }

        // even if body is not empty, but the body type is not known, we do not know how to parse the same
        //
        // @note if you'd like to support additional body types beyond formdata, url-encoding, etc, add the same to
        //       the builder module
        if (!requestBodyBuilders.hasOwnProperty(requestBodyType)) {
            return;
        }

        return requestBodyBuilders[requestBodyType](bodyContent, request);
    }
function ( request , protocolProfileBehavior ) { if ( ! ( request && request . body ) ) { return ; } var requestBody = request . body , requestBodyType = requestBody . mode , requestMethod = ( typeof request . method === 'string' ) ? request . method . toLowerCase ( ) : undefined , bodyIsEmpty = requestBody . isEmpty ( ) , bodyIsDisabled = requestBody . disabled , bodyContent = requestBody [ requestBodyType ] , // flag to decide body pruning for METHODS_WITHOUT_BODY // @note this will be `true` even if protocolProfileBehavior is undefined pruneBody = protocolProfileBehavior ? ! protocolProfileBehavior . disableBodyPruning : true ; // early bailout for empty or disabled body (this area has some legacy shenanigans) if ( bodyIsEmpty || bodyIsDisabled ) { return ; } // bail out if request method doesn't support body and pruneBody is true. if ( METHODS_WITHOUT_BODY [ requestMethod ] && pruneBody ) { return ; } // even if body is not empty, but the body type is not known, we do not know how to parse the same // // @note if you'd like to support additional body types beyond formdata, url-encoding, etc, add the same to //       the builder module if ( ! requestBodyBuilders . hasOwnProperty ( requestBodyType ) ) { return ; } return requestBodyBuilders [ requestBodyType ] ( bodyContent , request ) ; }
Processes a request body and puts it in a format compatible with
the "request" library.

@todo: Move this to the SDK.
@param request - Request object
@param protocolProfileBehavior - Protocol profile behaviors

@returns {Object}
Processes a request body and puts it in a format compatible with the request library .