Update CLAUDE.md and README for revised behavior
Document RateLimit's RemoteAddr-by-default keying and WithTrustedProxies, and that WithMaxResponseBody returns ErrResponseTooLarge rather than truncating.
This commit is contained in:
@@ -67,7 +67,7 @@ Server middleware is `func(http.Handler) http.Handler`. The `server` package pro
|
||||
| `server.Logging` | Structured request logging (method, path, status, duration, request ID). |
|
||||
| `server.HealthHandler` | Liveness (`/healthz`) and readiness (`/readyz`) endpoints with pluggable checkers. |
|
||||
| `server.CORS` | Cross-origin resource sharing with preflight handling and functional options. |
|
||||
| `server.RateLimit` | Per-key token bucket rate limiting with IP extraction and `Retry-After`. |
|
||||
| `server.RateLimit` | Per-key token bucket rate limiting (keys on `RemoteAddr`; `X-Forwarded-For` via `WithTrustedProxies`) with `Retry-After`. |
|
||||
| `server.MaxBodySize` | Limits request body size via `http.MaxBytesReader`. |
|
||||
| `server.Timeout` | Context-based request timeout, returns 503 on expiry. |
|
||||
| `server.WriteJSON` | JSON response helper, sets Content-Type and status. |
|
||||
@@ -195,6 +195,9 @@ client := httpx.New(
|
||||
)
|
||||
```
|
||||
|
||||
Reading a body that exceeds the limit returns `httpx.ErrResponseTooLarge`
|
||||
(checkable with `errors.Is`) rather than silently truncating.
|
||||
|
||||
## Examples
|
||||
|
||||
See the [`examples/`](examples/) directory for runnable programs:
|
||||
|
||||
Reference in New Issue
Block a user