forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): add
REQUEST
, RESPONSE_INIT
and REQUEST_CONTEXT
…
…tokens This commit introduces the `REQUEST`, `RESPONSE_INIT` and `REQUEST_CONTEXT` tokens, which will replace similar ones from https://github.com/angular/angular-cli/blob/28503186230b5e22b84499641d56c9c981fdab1d/packages/angular/ssr/tokens/src/tokens.ts, so those tokens would be imported in application code via `@angular/core` package.
- Loading branch information
1 parent
64cfe18
commit 66c8254
Showing
7 changed files
with
83 additions
and
12 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
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
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,70 @@ | ||
/** | ||
* @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.dev/license | ||
*/ | ||
|
||
import {InjectionToken} from '../di/injection_token'; | ||
|
||
/** | ||
* Injection token representing the current HTTP request object. | ||
* | ||
* Use this token to access the current request when handling server-side | ||
* rendering (SSR). | ||
* | ||
* @remarks | ||
* This token may be `null` in the following scenarios: | ||
* | ||
* * During the build processes. | ||
* * When the application is rendered in the browser (client-side rendering). | ||
* * When performing static site generation (SSG). | ||
* * During route extraction in development (at the time of the request). | ||
* | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | `Request` on MDN} | ||
* | ||
* @developerPreview | ||
*/ | ||
export const REQUEST = new InjectionToken<Request | null>('REQUEST', { | ||
providedIn: 'platform', | ||
factory: () => null, | ||
}); | ||
|
||
/** | ||
* Injection token for response initialization options. | ||
* | ||
* Use this token to provide response options for configuring or initializing | ||
* HTTP responses in server-side rendering or API endpoints. | ||
* | ||
* @remarks | ||
* This token may be `null` in the following scenarios: | ||
* | ||
* * During the build processes. | ||
* * When the application is rendered in the browser (client-side rendering). | ||
* * When performing static site generation (SSG). | ||
* * During route extraction in development (at the time of the request). | ||
* | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/Response | `ResponseInit` on MDN} | ||
* | ||
* @developerPreview | ||
*/ | ||
export const RESPONSE_INIT = new InjectionToken<ResponseInit | null>('RESPONSE_INIT', { | ||
providedIn: 'platform', | ||
factory: () => null, | ||
}); | ||
|
||
/** | ||
* Injection token for additional request context. | ||
* | ||
* Use this token to pass custom metadata or context related to the current request in server-side rendering. | ||
* | ||
* @remarks | ||
* This token is only available during server-side rendering and will be `null` in other contexts. | ||
* | ||
* @developerPreview | ||
*/ | ||
export const REQUEST_CONTEXT = new InjectionToken<unknown>('REQUEST_CONTEXT', { | ||
providedIn: 'platform', | ||
factory: () => null, | ||
}); |
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
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