Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor(http): add context property to httpResource
This was an oversight, `context` can be supported out of the box.
  • Loading branch information
JeanMeche committed Mar 4, 2025
commit 62ae5317ff3eb8dfb99dc00c91427e8c756fdeb7
1 change: 1 addition & 0 deletions goldens/public-api/common/http/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ export interface HttpResourceRef<T> extends WritableResource<T>, ResourceRef<T>
// @public
export interface HttpResourceRequest {
body?: unknown;
context?: HttpContext;
headers?: HttpHeaders | Record<string, string | ReadonlyArray<string>>;
method?: string;
params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
Expand Down
6 changes: 6 additions & 0 deletions packages/common/http/src/resource_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {Injector, ResourceRef, Signal, ValueEqualityFn, WritableResource} f
import type {HttpHeaders} from './headers';
import type {HttpParams} from './params';
import type {HttpProgressEvent} from './response';
import {HttpContext} from './context';

/**
* The structure of an `httpResource` request which will be sent to the backend.
Expand Down Expand Up @@ -50,6 +51,11 @@ export interface HttpResourceRequest {
*/
headers?: HttpHeaders | Record<string, string | ReadonlyArray<string>>;

/**
* Context of the request stored in a dictionary of key-value pairs.
*/
context?: HttpContext;

/**
* If `true`, progress events will be enabled for the request and delivered through the
* `HttpResource.progress` signal.
Expand Down