Optional
init: RequestInitOptional
init: RequestInitimport {createMockEndpointFetch, fetchEndpoint} from '@rest-vir/define-service';
fetchEndpoint(myService.endpoints['/my-path'], {
fetch: createMockEndpointFetch(myService.endpoints['/my-path'], {
body: 'some body',
// there are other properties that can be mocked as well, see the types for more details
}),
});
Creates a mock
fetch
function that returns a mockResponse
object that matches the expectations of the given endpoint. For more genericfetch
mocking, see createMockFetch.