Mocking requestsReferences
Rest
RestConfig
Prop
Type
RestRequestConfig
Prop
Type
RestRouteConfig<Method>
There are 3 ways to specify the RestRequestConfig:
You can pass a queue field with an array of timed responses (for polling/queues):
Prop
Type
Or you can specify a single response with the data field:
Prop
Type
Or you can specify a file response with the file field:
Prop
Type
RestDataResponse<Method>
<Method extends RestMethod = RestMethod>
((request: Request, entities: RestEntitiesByEntityName<Method>) => Data | Promise<Data>) | Data;RestSettings
Prop
Type
RestMethod
HTTP methods supported by REST configs
'delete' | 'get' | 'options' | 'patch' | 'post' | 'put';RestEntitiesByEntityName<Method>
A record type that maps entity names to their corresponding entity definitions. The available entity names depend on the HTTP method.
For GET, DELETE, and OPTIONS requests (methods without request body):
{
cookies?: RestEntity<'cookies'>;
headers?: RestEntity<'headers'>;
params?: RestEntity<'params'>;
query?: RestEntity<'query'>;
}For POST, PUT, and PATCH requests (methods with request body):
{
cookies?: RestEntity<'cookies'>;
headers?: RestEntity<'headers'>;
params?: RestEntity<'params'>;
query?: RestEntity<'query'>;
body?: RestEntity<'body'>;
}