src/swagger/corsMiddleware.js
function getOperationResponseHeaders(operation) {
    var headers = [];

    if (operation) {
        _.each(operation.responses, function(response, responseCode) {
            // Convert responseCode to a numeric value for sorting ("default" comes last)
            responseCode = parseInt(responseCode) || 999;

            _.each(response.headers, function(header, name) {
                // We only care about headers that have a default value defined
                if (header.default !== undefined) {
                    headers.push({
                        order: responseCode,
                        name: name.toLowerCase(),
                        value: header.default
                    });
                }
            });
        });
    }

    return _.sortBy(headers, 'order');
}
function getOperationResponseHeaders(operation) {
    var headers = [];

    if (operation) {
        _.each(operation.responses, function(response, responseCode) {
            // Convert responseCode to a numeric value for sorting ("default" comes last)
            responseCode = parseInt(responseCode) || 999;

            _.each(response.headers, function(header, name) {
                // We only care about headers that have a default value defined
                if (header.default !== undefined) {
                    headers.push({
                        order: responseCode,
                        name: name.toLowerCase(),
                        value: header.default
                    });
                }
            });
        });
    }

    return _.sortBy(headers, 'order');
}
function getOperationResponseHeaders ( operation ) { var headers = [ ] ; if ( operation ) { _ . each ( operation . responses , function ( response , responseCode ) { // Convert responseCode to a numeric value for sorting ("default" comes last) responseCode = parseInt ( responseCode ) || 999 ; _ . each ( response . headers , function ( header , name ) { // We only care about headers that have a default value defined if ( header . default !== undefined ) { headers . push ( { order : responseCode , name : name . toLowerCase ( ) , value : header . default } ) ; } } ) ; } ) ; } return _ . sortBy ( headers , 'order' ) ; }
Returns all response headers for the given Swagger operation, sorted by HTTP response code.

@param   {object}    operation - The Operation object from the Swagger API
@returns {{responseCode: integer, name: string, value: string}[]}
Returns all response headers for the given Swagger operation sorted by HTTP response code .