Skip to content

Commit

Permalink
fix(types): add generic type to MockedRequest.passthrough (#2198)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Bächler <[email protected]>
  • Loading branch information
sbaechler and Simon Bächler committed Sep 7, 2024
1 parent a80b3b1 commit e13e646
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/request/MockedRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ export class MockedRequest<
* Bypass the intercepted request.
* This will make a call to the actual endpoint requested.
*/
public passthrough(): MockedResponse<null> {
public passthrough<
BodyType extends DefaultBodyType = null,
>(): MockedResponse<BodyType> {
return {
// Constructing a dummy "101 Continue" mocked response
// to keep the return type of the resolver consistent.
status: 101,
statusText: 'Continue',
headers: new Headers(),
body: null,
body: null as BodyType,
// Setting "passthrough" to true will signal the response pipeline
// to perform this intercepted request as-is.
passthrough: true,
Expand Down

0 comments on commit e13e646

Please sign in to comment.