Coder Social home page Coder Social logo

Comments (8)

jaydenseric avatar jaydenseric commented on May 19, 2024 2

For multipart requests, boundaries are meant to be a string that doesn't occur anywhere in the content. Implementations such as FormData/fetch in browsers generate gnarly random looking boundaries; I'm not sure if they are deterministically generated based on the content or if they differ each request.

As stated previously, each body part is preceded by an encapsulation boundary. The encapsulation boundary MUST NOT appear inside any of the encapsulated parts. Thus, it is crucial that the composing agent be able to choose and specify the unique boundary that will separate the parts.
https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

from graphql-over-http.

benjie avatar benjie commented on May 19, 2024 1

I imagine interoperability to be easier if the boundary is prescribed to always be the same. How are different boundaries useful or necessary?

Interoperability is easier if the boundary is not prescribed because, as Jayden mentions, many clients automatically generate the boundaries. If we prescribe it, people may have to write their own multipart clients.

from graphql-over-http.

spawnia avatar spawnia commented on May 19, 2024

I imagine interoperability to be easier if the boundary is prescribed to always be the same. How are different boundaries useful or necessary?

from graphql-over-http.

jaydenseric avatar jaydenseric commented on May 19, 2024

Interoperability aside I don't think a specific string can be specified, otherwise if any of the data contains that string the response content is invalid. If a single dash char (-) is the specified boundary, what if you have to transfer data like this (containing 3 - chars):

{
  "name": "Mary-Louise Smith",
  "birthday": "1990-01-02"
}

from graphql-over-http.

benjie avatar benjie commented on May 19, 2024

I don't believe that situation can occur in JSON:

Note that the encapsulation boundary must occur at the beginning of a line, i.e., following a CRLF, and that that initial CRLF is considered to be part of the encapsulation boundary rather than part of the preceding part. The boundary must be followed immediately either by another CRLF and the header fields for the next part, or [...]

The closest you could get would be including - followed by a number:

{
  "number":
-1
}

from graphql-over-http.

robrichard avatar robrichard commented on May 19, 2024

I also don't think there is the possibility of a boundary of - conflicting with JSON data as the boundary needs to be preceded by a CRLF and a prefix of --, but I agree it should be supported.

I opened a PR to update the RFC to state that arbitrary boundaries are allowed: #143

I also updated my client library fetch-multipart-graphql (mentioned in the RFC) to support arbitrary boundaries. I will keep my express-graphql PR with the hardcoded - boundary.

from graphql-over-http.

IvanGoncharov avatar IvanGoncharov commented on May 19, 2024

@benjie Can I close this issue since we merged #143?

from graphql-over-http.

benjie avatar benjie commented on May 19, 2024

Yep 👍

from graphql-over-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.