Skip to content

Commit 935cea4

Browse files
committed
routing: add missing response headers
1 parent 937754a commit 935cea4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/routing/http-routing-v1.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ This API uses a standard version prefix in the path, such as `/v1/...`. If a bac
7171
- `404` (Not Found): must be returned if no matching records are found.
7272
- `422` (Unprocessable Entity): request does not conform to schema or semantic constraints.
7373

74+
#### Response Headers
75+
76+
- `Content-Type`: the content type of this response, which MUST be `application/json` or `application/x-ndjson` (see [streaming](#streaming)).
77+
- `Last-Modified`: the timestamp of the resolution.
78+
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with the response. When present, it SHOULD be short for responses that do whose resolution ended in no results (e.g. 15 seconds), and CAN be longer for responses that have results (e.g. 5 minutes).
79+
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
80+
7481
#### Response Body
7582

7683
```json
@@ -108,6 +115,13 @@ represented as a CIDv1 encoded with `libp2p-key` codec.
108115
- `404` (Not Found): must be returned if no matching records are found.
109116
- `422` (Unprocessable Entity): request does not conform to schema or semantic constraints.
110117

118+
#### Response Headers
119+
120+
- `Content-Type`: the content type of this response, which MUST be `application/json` or `application/x-ndjson` (see [streaming](#streaming)).
121+
- `Last-Modified`: the timestamp of the resolution.
122+
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with the response. When present, it SHOULD be short for responses that do whose resolution ended in no results (e.g. 15 seconds), and CAN be longer for responses that have results (e.g. 5 minutes).
123+
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
124+
111125
#### Response Body
112126

113127
```json
@@ -148,7 +162,9 @@ Each object in the `Peers` list is a record conforming to the [Peer Schema](#pee
148162
#### Response Headers
149163

150164
- `Etag`: a globally unique opaque string used for HTTP caching. MUST be derived from the protobuf record returned in the body.
151-
- `Cache-Control: max-age={TTL}`: cache TTL returned with :ref[IPNS Record] that has `IpnsEntry.data[TTL] > 0`. When present, SHOULD match the TTL value from the record. When record was not found (HTTP 404) or has no TTL (value is `0`), implementation SHOULD default to `max-age=60`.
165+
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with :ref[IPNS Record] that has `IpnsEntry.data[TTL] > 0`. When present, SHOULD match the TTL value from the record. When record was not found (HTTP 404) or has no TTL (value is `0`), implementation SHOULD default to `max-age=60`. Implementations CAN also include other derivatives, such as `stale-while-revalidate` and `stale-if-error`.
166+
- `Expires: {SIGNATURE_EXPIRATION}`: header with time when the signature expires.
167+
- `Last-Modified`: with the timestamp of the resolution.
152168

153169
#### Response Body
154170

0 commit comments

Comments
 (0)