Regex param doesn't match dots
- Dominant language
- Go
- Stars
- 22.8k
- Forks
- 1.2k
- Avg merge
- 5h 17m
- Merged PRs (30d)
- 10
Description
Example program:
```go
package main
import (
"fmt"
"net/http"
"net/http/httptest"
"github.com/go-chi/chi/v5"
)
func main() {
mux := chi.NewMux()
mux.Get("/{param:.+}.json", func(w http.ResponseWriter, r *http.Request) {
param := chi.URLParam(r, "param")
_, _ = fmt.Fprintf(w, "param=%s", param)
})
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/param.json", nil)
mux.ServeHTTP(rec, req)
fmt.Printf("code: %d, body: %s\n", rec.Code, rec.Body)
rec = httptest.NewRecorder()
req = httptest.NewRequest(http.MethodGet, "/param.with.dots.json", nil)
mux.ServeHTTP(rec, req)
fmt.Printf("code: %d, body: %s\n", rec.Code, rec.Body)
}
```
Expected:
```
code: 200, body: param=param
code: 404, body: param=param.with.dots
```
Got:
```
code: 200, body: param=param
code: 404, body: 404 page not found
```
Contributor guide
Assessment
This issue has not been assessed yet.