pattern.go 391 B

12345678910111213141516
  1. //go:build go1.23 && !tinygo
  2. // +build go1.23,!tinygo
  3. package chi
  4. import "net/http"
  5. // supportsPattern is true if the Go version is 1.23 and above.
  6. //
  7. // If this is true, `net/http.Request` has field `Pattern`.
  8. const supportsPattern = true
  9. // setPattern sets the mux matched pattern in the http Request.
  10. func setPattern(rctx *Context, r *http.Request) {
  11. r.Pattern = rctx.routePattern
  12. }