lib/collection/request-body.js
function () {
        var mode = this.mode,
            data = mode && this[mode];

        // bail out if there's no data for the selected mode
        if (!data) {
            return true;
        }

        // Handle file mode
        // @note this is a legacy exception. ideally every individual data mode
        // in future would declare its "empty state".
        if (mode === RequestBody.MODES.file) {
            return !(data.src || data.content);
        }

        if (_.isString(data)) {
            return (data.length === 0);
        }

        if (_.isFunction(data.count)) { // handle for property lists
            return (data.count() === 0);
        }

        return _.isEmpty(data); // catch all for remaining data modes
    }
function () {
        var mode = this.mode,
            data = mode && this[mode];

        // bail out if there's no data for the selected mode
        if (!data) {
            return true;
        }

        // Handle file mode
        // @note this is a legacy exception. ideally every individual data mode
        // in future would declare its "empty state".
        if (mode === RequestBody.MODES.file) {
            return !(data.src || data.content);
        }

        if (_.isString(data)) {
            return (data.length === 0);
        }

        if (_.isFunction(data.count)) { // handle for property lists
            return (data.count() === 0);
        }

        return _.isEmpty(data); // catch all for remaining data modes
    }
function ( ) { var mode = this . mode , data = mode && this [ mode ] ; // bail out if there's no data for the selected mode if ( ! data ) { return true ; } // Handle file mode // @note this is a legacy exception. ideally every individual data mode // in future would declare its "empty state". if ( mode === RequestBody . MODES . file ) { return ! ( data . src || data . content ) ; } if ( _ . isString ( data ) ) { return ( data . length === 0 ) ; } if ( _ . isFunction ( data . count ) ) { // handle for property lists return ( data . count ( ) === 0 ) ; } return _ . isEmpty ( data ) ; // catch all for remaining data modes }
If the request body is set to a mode, but does not contain data, then we should not be sending it.

@returns {Boolean}
If the request body is set to a mode but does not contain data then we should not be sending it .