lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) {
        if (_.isArray(requestV1.headers)) {
            return requestV1.headers;
        }

        var headers = [],
            traversed = {},
            headerData = requestV1.headerData || [],
            retainEmpty = this.options.retainEmptyValues;

        _.forEach(headerData, function (header) {
            if (_.startsWith(header.key, headersCommentPrefix) || (header.enabled === false)) {
                header.disabled = true;
                header.key = header.key.replace(headersCommentPrefix, '').trim();
            }

            // prevent empty header descriptions from showing up in converted results. This keeps the collections clean
            util.cleanEmptyValue(header, 'description', retainEmpty);

            delete header.enabled;
            headers.push(header); // @todo Improve this sequence to account for multi-valued headers

            traversed[header.key] = true;
        });

        // requestV1.headers is a string, so no descriptions can be obtained from it
        _.forEach(v1Common.parseHeaders(requestV1.headers), function (header) {
            !traversed[header.key] && headers.push(header);
        });

        return headers;
    }
function (requestV1) {
        if (_.isArray(requestV1.headers)) {
            return requestV1.headers;
        }

        var headers = [],
            traversed = {},
            headerData = requestV1.headerData || [],
            retainEmpty = this.options.retainEmptyValues;

        _.forEach(headerData, function (header) {
            if (_.startsWith(header.key, headersCommentPrefix) || (header.enabled === false)) {
                header.disabled = true;
                header.key = header.key.replace(headersCommentPrefix, '').trim();
            }

            // prevent empty header descriptions from showing up in converted results. This keeps the collections clean
            util.cleanEmptyValue(header, 'description', retainEmpty);

            delete header.enabled;
            headers.push(header); // @todo Improve this sequence to account for multi-valued headers

            traversed[header.key] = true;
        });

        // requestV1.headers is a string, so no descriptions can be obtained from it
        _.forEach(v1Common.parseHeaders(requestV1.headers), function (header) {
            !traversed[header.key] && headers.push(header);
        });

        return headers;
    }
function ( requestV1 ) { if ( _ . isArray ( requestV1 . headers ) ) { return requestV1 . headers ; } var headers = [ ] , traversed = { } , headerData = requestV1 . headerData || [ ] , retainEmpty = this . options . retainEmptyValues ; _ . forEach ( headerData , function ( header ) { if ( _ . startsWith ( header . key , headersCommentPrefix ) || ( header . enabled === false ) ) { header . disabled = true ; header . key = header . key . replace ( headersCommentPrefix , '' ) . trim ( ) ; } // prevent empty header descriptions from showing up in converted results. This keeps the collections clean util . cleanEmptyValue ( header , 'description' , retainEmpty ) ; delete header . enabled ; headers . push ( header ) ; // @todo Improve this sequence to account for multi-valued headers traversed [ header . key ] = true ; } ) ; // requestV1.headers is a string, so no descriptions can be obtained from it _ . forEach ( v1Common . parseHeaders ( requestV1 . headers ) , function ( header ) { ! traversed [ header . key ] && headers . push ( header ) ; } ) ; return headers ; }
Constructs an array of Key-Values from a raw HTTP Header string.

@param {Object} requestV1 - The v1 request to extract header information from.
@returns {Object[]} - A list of header definition objects.
Constructs an array of Key - Values from a raw HTTP Header string .