Skip to content

Commit 1b12423

Browse files
committed
cleanup
1 parent a34a7cb commit 1b12423

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

src/ipips/ipip-0410.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ order: 410
1515
tags: ['ipips']
1616
---
1717

18-
Introduce backwards-compatible streaming support to the Routing V1 HTTP API by
19-
using the HTTP Header `Accept` (:cite[rfc9110]) with [Newline Delimited JSON (NDJSON)](http://ndjson.org/).
18+
Introduce backwards-compatible streaming support to the Routing V1 HTTP API.
19+
For this, we use the `Accept` HTTP header (:cite[rfc9110]) for content type negotiation, as well
20+
as the Newline Delimited JSON ([NDJSON]) format.
2021

2122
## Motivation
2223

@@ -31,22 +32,32 @@ as they are available. This reduces latency and allows for faster content discov
3132
In addition, streaming responses may produce an unlimited amount of results, which
3233
is not the case for non-streamed responses.
3334

34-
## Detailed design
35+
## Detailed Design
3536

36-
In summary, streaming is supported by using the `Accept` HTTP header (:cite[rfc9110])
37-
along with the `application/x-ndjson` content type. For more details regarding the design,
38-
check :cite[http-routing-v1].
37+
In summary, streaming is supported by using the `Accept` HTTP header, which is used
38+
for content type negotiation as described in :cite[rfc9110]. The client sends an
39+
`Accept` HTTP header starting with `application/x-ndjson`, which is the content
40+
type for [NDJSON]. The following happens:
3941

40-
## Design rationale
42+
- The client adds the `Accept` HTTP header in the request starting with `application/x-ndjson`.
43+
- The server checks the `Accept` HTTP header from the request and, if it contains
44+
`application/x-ndjson`, they reply with NDJSON. If they don't support NDJSON, they
45+
can reply with JSON.
46+
- The server response MUST contain a `Content-Type` HTTP header indicating the
47+
response type, which may be either `application/json` for non-streaming responses,
48+
and `application/x-ndjson` for streamed responses.
4149

42-
The idea is to not break compatibility with existing clients and servers. Therefore,
43-
we can use the `Accept` HTTP header for content negotiation. If the client supports
44-
streaming, they can advertise so by including `application/x-ndjson` in the headers.
45-
If the server supports streaming, the response will have `Content-Type` HTTP header
46-
of `application/x-ndjson` with a streaming response. Otherwise, it will fall back
47-
to a pure JSON, non-streamed, response.
50+
For more details regarding the design, check :cite[http-routing-v1].
4851

49-
### User benefit
52+
## Design Rationale
53+
54+
This feature is designed such that it does not break compatibility with existing
55+
clients and servers. The `Accept` HTTP header is OPTIONAL. By default, the server
56+
MUST respond with `application/json` unless the client explicitly asked for
57+
`application/x-ndjson`. If the server does not support NDJSON, it is allowed
58+
to still respond with non-streamed JSON.
59+
60+
### User Benefit
5061

5162
Users (clients) will benefit from this change as the servers will now be able
5263
to respond more promptly to provider record requests. Instead of waiting for the whole
@@ -67,3 +78,5 @@ Security considerations are equivalent as the ones in :cite[ipip-0337].
6778
### Copyright
6879

6980
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
81+
82+
[NDJSON]: http://ndjson.org/

0 commit comments

Comments
 (0)