feat(http): Add support for strings as http method names

Closes #4331
This commit is contained in:
mgechev
2015-09-21 10:46:16 +03:00
committed by Jeff Cross
parent a251df9df4
commit 34518f0f2d
5 changed files with 46 additions and 6 deletions
+23
View File
@@ -319,6 +319,29 @@ export function main() {
res => {});
}));
});
describe('string method names', () => {
it('should allow case insensitive strings for method names', () => {
inject([AsyncTestCompleter], (async) => {
ObservableWrapper.subscribe<MockConnection>(backend.connections, c => {
expect(c.request.method)
.toBe(RequestMethods.Post)
c.mockRespond(new Response(new ResponseOptions({body: 'Thank you'})));
async.done();
});
ObservableWrapper.subscribe(http.request(new Request(new RequestOptions(
{url: 'https://google.com', method: 'PosT'}))),
(res) => {});
});
});
it('should throw when invalid string parameter is passed for method name', () => {
expect(() => {
http.request(
new Request(new RequestOptions({url: 'https://google.com', method: 'Invalid'})));
}).toThrowError('Invalid request method. The method "Invalid" is not supported.');
});
});
});
describe('Jsonp', () => {