fix(http): Fix error message when we call jsonp without importing HttpClientJsonpModule (#38756)

Currently, when we call jsonp method without importing HttpClientJsonpModule, an error message appears saying
'Attempted to construct Jsonp request without JsonpClientModule installed.' instance of 'Attempted to
construct Jsonp request without HttpClientJsonpModule installed.'

PR Close #38756
This commit is contained in:
William Koza 2020-09-09 13:03:01 +02:00 committed by Misko Hevery
parent 2d6105a784
commit 88d7bb8386
1 changed files with 3 additions and 2 deletions

View File

@ -79,9 +79,10 @@ export class HttpXhrBackend implements HttpBackend {
*/
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
// Quick check to give a better error message when a user attempts to use
// HttpClient.jsonp() without installing the JsonpClientModule
// HttpClient.jsonp() without installing the HttpClientJsonpModule
if (req.method === 'JSONP') {
throw new Error(`Attempted to construct Jsonp request without JsonpClientModule installed.`);
throw new Error(
`Attempted to construct Jsonp request without HttpClientJsonpModule installed.`);
}
// Everything happens on Observable subscription.