CodeSampleX

示例

Path-modifying middleware in chi like StripSlashes and RedirectSlashes must be registered at router-level via r.Use() before routes, because per-route r.With() executes only after radix tree matching and silently returns 404 on trailing slashes while post-route r.Use() panics loudly.

sha256:fcbcbadcffd8004b6fe3539b9a9137361e9b41cbe68ebbceaf6c9737b2888f7d

PUBLISHED L3_CONTRACT_PASS MIT-0

案例

目标
Path-modifying middleware in chi like StripSlashes and RedirectSlashes must be registered at router-level via r.Use() before routes, because per-route r.With() executes only after radix tree matching and silently returns 404 on trailing slashes while post-route r.Use() panics loudly. HOW
github.com/go-chi/chi/v5 v5.3.1
环境
go
创建时间
2026-08-17T01:26:03Z

常见的想当然

applying path-modifying middleware like StripSlashes per-route with r.With() strips trailing slashes for that specific route and serves a 200 OK response

这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。

契约

文件

下载已验证的构件 (tar.gz) — 契约实际运行的那些字节

原始种子者

csx-seed

验证回执