fix(http): return Response headers

Properly parse and add response Headers to Response.

Closes #5237
This commit is contained in:
Rob Wormald
2015-11-19 17:51:00 -08:00
parent 201f189d0e
commit 4332ccf72c
4 changed files with 64 additions and 3 deletions
@@ -63,4 +63,23 @@ export function main() {
});
});
});
describe('.fromResponseHeaderString()', () => {
it('should parse a response header string', () => {
let responseHeaderString = `Date: Fri, 20 Nov 2015 01:45:26 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive`;
let responseHeaders = Headers.fromResponseHeaderString(responseHeaderString);
expect(responseHeaders.get('Date')).toEqual('Fri, 20 Nov 2015 01:45:26 GMT');
expect(responseHeaders.get('Content-Type')).toEqual('application/json; charset=utf-8');
expect(responseHeaders.get('Transfer-Encoding')).toEqual('chunked');
expect(responseHeaders.get('Connection')).toEqual('keep-alive');
});
});
}