Skip to content

Commit

Permalink
Mark API as experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeckem committed Dec 18, 2023
1 parent 4a06372 commit 768d3d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .changeset/young-wolves-clap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"@open-pioneer/http": minor
---

New feature: request interceptors.
New **experimental** feature: request interceptors.
Request interceptors can be registered with the `HttpService` to modify requests before they are sent to a server.
Request interceptors are called automatically by the `HttpService` when they are present as part of the normal request processing.

Example use case: adding an access token (query parameter or header) to requests for a certain resource.

Note that the request interceptor API is experimental: it may change with a new minor release as a response to feedback.
2 changes: 2 additions & 0 deletions src/packages/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ However, the `HttpService`'s method should always be preferred to take advantage

## Request interceptors

> Note that the request interceptor API is experimental: it may change with a new minor release as a response to feedback.
The `HttpService` supports extension via _request interceptors_.
Request interceptors can modify requests (query parameters, headers, etc.) before they are sent to the server.

Expand Down
2 changes: 2 additions & 0 deletions src/packages/http/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export type ContextData = Record<string | symbol, unknown>;
* or to manipulate a backend response.
*
* Use the interface name `http.Interceptor` to provide an implementation of this interface.
*
* > Note that the request interceptor API is experimental: it may change with a new minor release as a response to feedback.
*/
export interface Interceptor extends DeclaredService<"http.Interceptor"> {
beforeRequest?(params: BeforeRequestParams): void | Promise<void>;
Expand Down

0 comments on commit 768d3d0

Please sign in to comment.