Update CLAUDE.md and README for revised behavior
All checks were successful
CI / test (push) Successful in 38s
Publish / publish (push) Successful in 35s

Document RateLimit's RemoteAddr-by-default keying and WithTrustedProxies, and
that WithMaxResponseBody returns ErrResponseTooLarge rather than truncating.
This commit is contained in:
2026-05-23 13:47:43 +03:00
parent b5259af73e
commit f609b12c2f
2 changed files with 6 additions and 3 deletions

View File

@@ -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: