Chi 5.3
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
3prompts
- Go 1.27130 lines · 5.5K tokens
- Go net/http 1.2772 lines · 3.9K tokens
- Chi 5.359 lines · 2.9K tokens
Total261 lines · 12.2K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 250
- 252
- 257
- 287
- 295
- 307
- 319
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 426
- 444
- 488
- 489
- 494
- 525
- 532
- 552
- 601
- 613
- 639
- 672
- 732
- 759
- 770
- 772
- 807
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1021
- 1275
- 1395
- 1428
Prompt Preview
Apply the Go net/http 1.27 prompt first. Use these rules for the Chi 5.3 line of github.com/go-chi/chi/v5 on Go 1.27; they were checked against 5.3.2. Use Chi's routing semantics for Chi endpoints; the baseline's http.ServeMux pattern and unescaping behavior do not automatically apply. Chi supplies no default authentication, sessions, CSRF protection, or server timeouts.
Router construction and middleware coverage
- Configure
chi.NewRouter, routes, middleware, and anychi.RegisterMethodcalls before serving requests. CompleteUsebefore registering routes or callingWithon the same non-inline mux; laterUsecalls panic. - Install shared security controls on the parent router and add endpoint policy through
With,Group, or a subrouter'sUse. Route-local middleware runs only after a match; do not assume it protectsNotFound,MethodNotAllowed, or sibling routes. - Wrap the router externally when a control must run even with no routes registered; an empty mux can call its 404 handler without executing its
Usestack. Preserve required headers and logging on custom fallback responses, and supply an accurateAllowheader when replacing Chi's default 405 handler. - Prefer
Get,Post, andMethodregistrations with deliberate method coverage. An unqualifiedHandleorHandleFuncaccepts every supported method, includingQUERY,CONNECT, andTRACE; inspect catch-all handlers and custom methods for unintended exposure. - Protect a mounted handler at its
Mountboundary. Chi advancesRouteContext.RoutePathfor subrouting but does not