Skip to content

Named examples are returned as '[object Object]' #97

Description

@jonaskuske

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions