fix(http): Update types for TypeScript nullability support

This commit is contained in:
Miško Hevery
2017-03-24 09:55:16 -07:00
committed by Tobias Bosch
parent 86396a43e9
commit c36ec9bf60
18 changed files with 138 additions and 128 deletions
+2 -2
View File
@@ -32,14 +32,14 @@ export function normalizeMethodName(method: string | RequestMethod): RequestMeth
export const isSuccess = (status: number): boolean => (status >= 200 && status < 300);
export function getResponseURL(xhr: any): string {
export function getResponseURL(xhr: any): string|null {
if ('responseURL' in xhr) {
return xhr.responseURL;
}
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL');
}
return;
return null;
}
export function stringToArrayBuffer(input: String): ArrayBuffer {