refactor(http): add context property to httpResource (#60188)

This was an oversight, `context` can be supported out of the box.

PR Close #60188
This commit is contained in:
Matthieu Riegler 2025-03-03 17:19:34 +01:00 committed by Miles Malerba
parent 8b8e3fdca4
commit bb14fe86e3
2 changed files with 7 additions and 0 deletions

View file

@ -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>>;

View file

@ -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.
@ -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.