Scope
@zimic/http
Prerequisites
Type
Adds a new behavior
Compatibility
Context
Currently in @zimic/http, path parameters are fully inferred from the pathname. As an additional feature, we could support custom path parameter declarations, similarly to searchParams.
import { type HttpSchema } from '@zimic/http';
interface User {
id: number
username: string;
}
interface RequestError {
code: string;
message: string;
}
type Schema = HttpSchema<{
'/users/:userId': {
PATCH: {
request: {
pathParams: { userId: User['id'] };
headers: { authorization: string };
body: Partial<User>;
};
response: {
204: {};
400: { body: RequestError };
};
};
};
}>;
Notes
- Path params should continue to be inferred as before. Declaring a custom
pathParams should only override the default params.
Feature description
Scope
@zimic/http
Prerequisites
Type
Adds a new behavior
Compatibility
Context
Currently in
@zimic/http, path parameters are fully inferred from the pathname. As an additional feature, we could support custom path parameter declarations, similarly tosearchParams.Notes
pathParamsshould only override the default params.Feature description
pathParamsin request schema declarationspathParamsin HTTP request handlerspathParamsin fetch clients