You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed this message about this lib being in maintenance mode but I hope this bug is big enough to fix or has an easy solution.
data/src/model/generateRestHandlers.tsline 200 and 217 both pass req.body to model methods that expect the data as a JS object but instead receive a string.
I have an ExpressJS server setup using MSW mock API endpoints with @mswjs/http-middleware's createMiddleware(...handlers). That middleware has these lines that always convert makes sure that req.body as a string (see issue).
I attempted to make a merge request to fix this but there were already some Jest tests failing on main and didn't know how to solve them. In this test the node-fetchfetch is catching the errors thrown by the mock server instead of the withErrors HOF and no longer passing. Ironically the POST and PUT's are having this issue. If you add fetch().catch it will catch it there but seems unintended.
Anyways, I hope we can find a way to fix this so that these libraries can work together in harmony.
Thank you!
EDIT: The issue may be more on the http-middleware library to solve. Like an optional alwaysParseReqBodyAsString: boolean option or something.
The text was updated successfully, but these errors were encountered:
I noticed this message about this lib being in maintenance mode but I hope this bug is big enough to fix or has an easy solution.
data/src/model/generateRestHandlers.ts
line 200 and 217 both passreq.body
tomodel
methods that expect the data as a JS object but instead receive a string.I have an ExpressJS server setup using MSW mock API endpoints with @mswjs/http-middleware's
createMiddleware(...handlers)
. That middleware has these lines that always convert makes sure thatreq.body
as a string (see issue).I attempted to make a merge request to fix this but there were already some Jest tests failing on
main
and didn't know how to solve them. In this test thenode-fetch
fetch
is catching the errors thrown by the mock server instead of thewithErrors
HOF and no longer passing. Ironically the POST and PUT's are having this issue. If you addfetch().catch
it will catch it there but seems unintended.Anyways, I hope we can find a way to fix this so that these libraries can work together in harmony.
Thank you!
EDIT: The issue may be more on the http-middleware library to solve. Like an optional
alwaysParseReqBodyAsString: boolean
option or something.The text was updated successfully, but these errors were encountered: