Skip to content

Commit

Permalink
Return responses from successful handler logic branch
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Nov 2, 2023
1 parent 0143504 commit 7d9b0ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/msw-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,9 @@ const handler =
if (typeof result === "function") {
return result();
}
if (result instanceof Response) {
return result;
}
return json(result);
} catch (thrown) {
if (typeof thrown === "number") {
Expand Down
3 changes: 3 additions & 0 deletions generator/client/msw-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ export function generateMSWHandlers(spec: OpenAPIV3.Document) {
if (typeof result === "function") {
return result();
}
if (result instanceof Response) {
return result;
}
return json(result);
} catch (thrown) {
if (typeof thrown === 'number') {
Expand Down

0 comments on commit 7d9b0ce

Please sign in to comment.