Mock Config logoMock config
Mocking requestsReferences

Rest

RestConfig

Prop

Type

RestRequestConfig

Prop

Type

RestRouteConfig<Method>

Route helpers accept several config forms and normalize them into RestRouteConfig.data.

Prop

Type

RestDataResponse<Method>

<Method extends RestMethod = RestMethod>
| Data
| ((params: RestParams<Method>) => Data | Promise<Data>)
| Generator<Data, Data | void, RestParams<Method>>;

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'>;
  queries?: RestEntity<'queries'>;
}

For POST, PUT, and PATCH requests (methods with request body):

{
  body?: RestEntity<'body'>;
  cookies?: RestEntity<'cookies'>;
  headers?: RestEntity<'headers'>;
  params?: RestEntity<'params'>;
  queries?: RestEntity<'queries'>;
}

On this page