lib/plugins/XMLHttpRequestPlugin.js
function parseResponseHeaders (headers) {
  var parsed = {};

  if (headers) {
    headers.split('\n').forEach(function (line) {
      var separatorIndex = line.indexOf(':');
      var key = line.substr(0, separatorIndex).trim().toLowerCase();
      var value = line.substr(separatorIndex + 1).trim().toLowerCase();

      if (key) {
        parsed[key] = value;
      }
    });
  }

  return parsed;
}
function parseResponseHeaders (headers) {
  var parsed = {};

  if (headers) {
    headers.split('\n').forEach(function (line) {
      var separatorIndex = line.indexOf(':');
      var key = line.substr(0, separatorIndex).trim().toLowerCase();
      var value = line.substr(separatorIndex + 1).trim().toLowerCase();

      if (key) {
        parsed[key] = value;
      }
    });
  }

  return parsed;
}
function parseResponseHeaders ( headers ) { var parsed = { } ; if ( headers ) { headers . split ( '\n' ) . forEach ( function ( line ) { var separatorIndex = line . indexOf ( ':' ) ; var key = line . substr ( 0 , separatorIndex ) . trim ( ) . toLowerCase ( ) ; var value = line . substr ( separatorIndex + 1 ) . trim ( ) . toLowerCase ( ) ; if ( key ) { parsed [ key ] = value ; } } ) ; } return parsed ; }
Parses HTTP response headers, and returns them as an object with header names as keys
and header values as values.

@param {?string} headers - Response headers, separated by CRLF
@returns {object}
Parses HTTP response headers and returns them as an object with header names as keys and header values as values .