Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec edits for multipart @defer @stream around content-length #152

Merged
merged 4 commits into from
Nov 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions rfcs/IncrementalDelivery.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,20 @@ An example response body will look like:
```
---
Content-Type: application/json; charset=utf-8
Content-Length: 45

{"data":{"hello":"Hello Rob"},"hasNext":true}

---
Content-Type: application/json; charset=utf-8
Content-Length: 57

{"data":{"test":"Hello World"},"path":[],"hasNext":false}

-----
```
* The boundary used is `-` and is passed to the client in the http response's `Content-Type` header. Note that headers can appear in both the HTTP response itself and as part of the response body. The `Content-Type` header must be sent in the HTTP response.
* Each part of the multipart response must start with `---` and a `CRLF`
* An initial boundary is sent marking the end of the preamble area.
* Each part of the multipart response must contain a `Content-Type` header. Similar to the GraphQL specification this specification does not require a specific serialization format. For consistency and ease of notation, examples of the response are given in JSON throughout the spec.
* Each part of the multipart response must contain a `Content-Length` header. This should be the number of bytes of the payload of the response. It does not include the size of the headers, boundaries, or `CRLF`s used to separate the content.
* After all headers, an additional `CRLF` is sent.
* The payload is sent, followed by two `CRLF`s.
* After the last part of the multipart response is sent, the terminating boundary `-----` is sent, followed by a `CRLF`
* The payload is sent, followed by a `CRLF`.
* After each payload, a boundary is sent. For the final payload, the terminating boundary of `-----` followed by a `CRLF` is sent. For all other payloads a boundary of `---` followed by a `CRFL` is sent.

## Server Implementations
* `express-graphql`: [pull request](https://github.com/graphql/express-graphql/pull/583)
Expand Down