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:
parent
6f579b20f8
commit
3902ec0dbe
@ -79,9 +79,10 @@ export class HttpXhrBackend implements HttpBackend {
|
|||||||
*/
|
*/
|
||||||
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
|
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
|
||||||
// Quick check to give a better error message when a user attempts to use
|
// 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') {
|
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.
|
// Everything happens on Observable subscription.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user