Comments (8)
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.
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.
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.
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.
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.
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.
@benjie Can I close this issue since we merged #143?
from graphql-over-http.
Yep 👍
from graphql-over-http.
Related Issues (20)
- Spec references RFC7231 which is obsoleted HOT 4
- Response status code as `application/json` content HOT 5
- Clarify the use of HTTP GET and POST request HOT 2
- Status codes for unauthenticated OAuth errors HOT 1
- Optional query discussion HOT 13
- GraphQL request optional parameters HOT 2
- Kitchen sink HTTP requests HOT 3
- Allow non-UTF-8 encodings HOT 2
- What is well-formed response HOT 3
- Status codes 404 and 410 HOT 1
- Clarification for `Accept: */*` HOT 8
- Should we explicitly support `Content-Type: application/graphql`? HOT 13
- Should the query property really be required? HOT 1
- Make it clear that extra keys in the request/response payloads are not allowed HOT 2
- [2023-10] Add changes promoting spec to RFC 2 status
- [2023-10] Add RFC2 status to next GraphQL Spec WG HOT 1
- Create the "Action Item" issue template
- [2023-11] Add notes about security to GraphQL-over-HTTP spec HOT 11
- [2024-01-25] Contact Apollo about persisted operations appendix HOT 2
- What is the rationale for handling Invalid parameters as 400? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-over-http.