Skip to content

Commit b56afd3

Browse files
committed
fix: Correct Legacy Header Name for gregjones/httpcache Compatibility
1 parent 770b377 commit b56afd3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,24 @@ To use a custom [ServeMux](https://pkg.go.dev/net/http#ServeMux), pass `expapi.W
119119
This package sets a cache status header on every response:
120120

121121
- `X-Httpcache-Status`: The primary, detailed cache status header (always set).
122-
- `X-Cache-Status`: (Legacy) Provided for compatibility with [`gregjones/httpcache`](https://github.com/gregjones/httpcache). Only set for cache hits/stale/revalidated responses.
122+
- `X-From-Cache`: (Legacy) Provided for compatibility with [`gregjones/httpcache`](https://github.com/gregjones/httpcache). Only set for cache hits/stale/revalidated responses.
123123

124124
### Header Value Mapping
125125

126-
| X-Httpcache-Status | X-Cache-Status | Description |
127-
| ------------------ | -------------- | ---------------------------------- |
128-
| HIT | 1 | Served from cache |
129-
| STALE | 1 | Served from cache but stale |
130-
| REVALIDATED | 1 | Revalidated with origin |
131-
| MISS | *(not set)* | Served from origin |
132-
| BYPASS | *(not set)* | Bypassed cache, served from origin |
126+
| X-Httpcache-Status | X-From-Cache | Description |
127+
| ------------------ | ------------ | ---------------------------------- |
128+
| HIT | 1 | Served from cache |
129+
| STALE | 1 | Served from cache but stale |
130+
| REVALIDATED | 1 | Revalidated with origin |
131+
| MISS | *(not set)* | Served from origin |
132+
| BYPASS | *(not set)* | Bypassed cache, served from origin |
133133

134134
### Example: Stale cache hit
135135

136136
```http
137137
HTTP/1.1 200 OK
138138
X-Httpcache-Status: STALE
139-
X-Cache-Status: 1
139+
X-From-Cache: 1
140140
Content-Type: application/json
141141
```
142142

internal/header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
const (
2222
CacheStatusHeader = "X-Httpcache-Status"
23-
CacheStatusHeaderLegacy = "X-Cache-Status" // Deprecated: use [CacheStatusHeader] instead
23+
CacheStatusHeaderLegacy = "X-From-Cache" // Deprecated: use [CacheStatusHeader] instead
2424
)
2525

2626
type CacheStatus struct {

0 commit comments

Comments
 (0)