fix(http): error on non-200 status codes

BREAKING CHANGE:

previously http would only error on network errors to match the fetch
specification. Now status codes less than 200 and greater than 299 will
cause Http's Observable to error.

Closes #5130.
This commit is contained in:
Rob Wormald
2015-11-23 22:17:13 +00:00
parent a35a93d0da
commit 201f189d0e
3 changed files with 67 additions and 13 deletions
+3
View File
@@ -1,6 +1,7 @@
import {isString} from 'angular2/src/facade/lang';
import {RequestMethods} from './enums';
import {makeTypeError} from 'angular2/src/facade/exceptions';
import {Response} from './static_response';
export function normalizeMethodName(method): RequestMethods {
if (isString(method)) {
@@ -14,4 +15,6 @@ export function normalizeMethodName(method): RequestMethods {
return method;
}
export const isSuccess = (status: number): boolean => (status >= 200 && status < 300);
export {isJsObject} from 'angular2/src/facade/lang';