fix(XhrBackend): setRequestHeader takes a string arg

Closes #4597
This commit is contained in:
Victor Berchet
2015-10-07 14:56:18 -07:00
parent bffab0f2db
commit 6b00b60488
3 changed files with 7 additions and 5 deletions
@@ -148,14 +148,16 @@ export function main() {
});
it('should attach headers to the request', () => {
var headers = new Headers({'Content-Type': 'text/xml', 'Breaking-Bad': '<3'});
var headers =
new Headers({'Content-Type': 'text/xml', 'Breaking-Bad': '<3', 'X-Multi': ['a', 'b']});
var base = new BaseRequestOptions();
var connection = new XHRConnection(
new Request(base.merge(new RequestOptions({headers: headers}))), new MockBrowserXHR());
connection.response.subscribe();
expect(setRequestHeaderSpy).toHaveBeenCalledWith('Content-Type', ['text/xml']);
expect(setRequestHeaderSpy).toHaveBeenCalledWith('Breaking-Bad', ['<3']);
expect(setRequestHeaderSpy).toHaveBeenCalledWith('Content-Type', 'text/xml');
expect(setRequestHeaderSpy).toHaveBeenCalledWith('Breaking-Bad', '<3');
expect(setRequestHeaderSpy).toHaveBeenCalledWith('X-Multi', 'a,b');
});
it('should return the correct status code', inject([AsyncTestCompleter], async => {