Skip to content

multipart/mixed boundary confusion #3153

@eden

Description

@eden

Describe the bug

When using @urql/core 3.2.2 with the default fetch exchange against graphql-yoga 3.8.0, the response will be incorrectly parsed if any part of the response data has the string '---'.

I believe the source of the issue starts here:

const boundaryHeader = contentType.match(boundaryHeaderRe);
const boundary = '--' + (boundaryHeader ? boundaryHeader[1] : '-');

graphql-yoga sends back a multipart mixed response with the default boundary of just -.

Reproduction

client side: https://codesandbox.io/s/crimson-butterfly-b2u6bl

server side: https://codesandbox.io/p/sandbox/charming-bogdan-exwjdx

Urql version

urql v3.0.4
@urql/core v3.2.2

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions