This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/testing / MockRequest

MockRequest ​

Request received by a MockHandler.

Properties ​

body ​

body: unknown

Body already decoded as JSON; for a multipart request (e.g. kyc.uploadDocument), the FormData itself; undefined when the request has no body.


headers ​

headers: Headers

Headers sent by the client, including authorization when the route requires a session.


method ​

method: string

HTTP method, uppercase.


params? ​

optional params?: Record<string, string>

Values of the :name segments of the matched route (already decoded), e.g. { depositId: 'dep-1' } for 'GET /api/v1/deposits/:depositId'. createMockFetch always fills it in ({} on routes without parameters); it is optional in the type only so as not to break whoever builds a MockRequest by hand.


url ​

url: URL

Request URL, resolved against a fixed origin when baseUrl is relative.