Description
When a named example is picked through ?example=name, the object value is not returned as JSON, the response simply says '[object Object]'.
I've provided a fix + test in https://github.com/jonaskuske/msw-source/tree/fix/stringify-named-example-object (before I saw that PRs are restricted here), feel free to merge from there :)
Reproduction steps
See https://github.com/jonaskuske/msw-source/blob/fix/stringify-named-example-object/src/open-api/utils/open-api-utils.test.ts#L85
Expected behavior
A JSON response.
Initial assessment
JSON.stringify is only called in the branch that picks the first example (no name provided), not in the case where a name is provided so the named example is picked.
Description
When a named example is picked through
?example=name, the object value is not returned as JSON, the response simply says '[object Object]'.I've provided a fix + test in https://github.com/jonaskuske/msw-source/tree/fix/stringify-named-example-object (before I saw that PRs are restricted here), feel free to merge from there :)
Reproduction steps
See https://github.com/jonaskuske/msw-source/blob/fix/stringify-named-example-object/src/open-api/utils/open-api-utils.test.ts#L85
Expected behavior
A JSON response.
Initial assessment
JSON.stringifyis only called in the branch that picks the first example (no name provided), not in the case where a name is provided so the named example is picked.