fix(http): throw if url is not string or Request

Closes #4245

Closes #4257
This commit is contained in:
Brian Yarger
2015-09-18 13:30:05 -07:00
parent dd9b3b4ed0
commit 3525d8a394
2 changed files with 28 additions and 0 deletions

View File

@ -120,6 +120,8 @@ export class Http {
new Request(mergeOptions(this._defaultOptions, options, RequestMethods.Get, url)));
} else if (url instanceof Request) {
responseObservable = httpRequest(this._backend, url);
} else {
throw makeTypeError('First argument must be a url string or Request instance.');
}
return responseObservable;
}
@ -201,6 +203,8 @@ export class Jsonp extends Http {
makeTypeError('JSONP requests must use GET request method.');
}
responseObservable = httpRequest(this._backend, url);
} else {
throw makeTypeError('First argument must be a url string or Request instance.');
}
return responseObservable;
}