Skip to content

Commit

Permalink
fix: revert back to manual type specification for passing type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Mann-16 committed Nov 21, 2023
1 parent 6f431ec commit 2bd83fb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/mock/src/msw/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,20 @@ export const generateMSW = (
override,
!isFunction(mock) ? mock : undefined,
)});
return HttpResponse.${isTextPlain ? 'text' : 'json'}(${
value && value !== 'undefined' ? `${functionName}()` : null
},
return new HttpResponse(${
value && value !== 'undefined'
? isTextPlain
? `${functionName}()`
: `JSON.stringify(${functionName}())`
: null
},
{
status: 200,
headers: {
'Content-Type': '${
isTextPlain ? 'text/plain' : 'application/json'
}',
}
}
)
}),`,
Expand Down

0 comments on commit 2bd83fb

Please sign in to comment.