-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(http): tree-shakable error on JSONP request (#50376)
This commit provides a tree shakable error message (+doc) when JSONP request is made without loading the `HttpClientJsonpModule`. PR Close #50376
- Loading branch information
1 parent
6e4f582
commit f3a13c2
Showing
6 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@name JSONP support in HttpClient configuration | ||
@category runtime | ||
@shortDescription Missing JSONP support in HttpClient configuration | ||
|
||
@description | ||
Angular produces this error when you attempt a `JSONP` request without providing the necessary support for it in the `HttpClient` configuration. | ||
To enable `JSONP` support, you can do one of the following: | ||
- add the `withJsonpSupport()` as an argument during the `provideHttpClient` function call (e.g. `provideHttpClient(withJsonpSupport())`) when `bootstrapApplication` is used | ||
- import the `HttpClientJsonpModule` in your root AppModule, when NgModule-based bootstrap is used. | ||
|
||
|
||
@debugging | ||
Make sure that the JSONP support is added into your application either by calling the `withJsonpSupport()` function (when the `provideHttpClient()` is used) or importing the `HttpClientJsonpModule` module as described above. | ||
|
||
See [Make a JSONP request](/guide/http-make-jsonp-request) for more info. | ||
|
||
<!-- links --> | ||
|
||
<!-- external links --> | ||
|
||
<!-- end links --> | ||
|
||
@reviewed 2023-05-02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## API Report File for "angular-srcs" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
// @public | ||
export const enum RuntimeErrorCode { | ||
// (undocumented) | ||
MISSING_JSONP_MODULE = -2800 | ||
} | ||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
/** | ||
* The list of error codes used in runtime code of the `common/http` package. | ||
* Reserved error code range: 2800-2899. | ||
*/ | ||
export const enum RuntimeErrorCode { | ||
MISSING_JSONP_MODULE = -2800, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters