Chi 5.3

Last reviewed Sep 19, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. Go 1.27130 lines · 5.5K tokens
  2. Go net/http 1.2772 lines · 3.9K tokens
  3. 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 any chi.RegisterMethod calls before serving requests. Complete Use before registering routes or calling With on the same non-inline mux; later Use calls panic.
  • Install shared security controls on the parent router and add endpoint policy through With, Group, or a subrouter's Use. Route-local middleware runs only after a match; do not assume it protects NotFound, 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 Use stack. Preserve required headers and logging on custom fallback responses, and supply an accurate Allow header when replacing Chi's default 405 handler.
  • Prefer Get, Post, and Method registrations with deliberate method coverage. An unqualified Handle or HandleFunc accepts every supported method, including QUERY, CONNECT, and TRACE; inspect catch-all handlers and custom methods for unintended exposure.
  • Protect a mounted handler at its Mount boundary. Chi advances RouteContext.RoutePath for subrouting but does not