Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there may be a issue with one of the tests in mux_test #636

Open
helios741 opened this issue Jul 13, 2021 · 1 comment
Open

there may be a issue with one of the tests in mux_test #636

helios741 opened this issue Jul 13, 2021 · 1 comment
Labels

Comments

@helios741
Copy link

in mux_test.go#L1469

1 func TestMuxRegexp2(t *testing.T) {
2	r := NewRouter()
3	r.Get("/foo-{suffix:[a-z]{2,3}}.json", func(w http.ResponseWriter, r *http.Request) {
4		w.Write([]byte(URLParam(r, "suffix")))
5	})
6	ts := httptest.NewServer(r)
7	defer ts.Close()
8
9	if _, body := testRequest(t, ts, "GET", "/foo-.json", nil); body != "" {
10		t.Fatalf(body)
11	}
12	if _, body := testRequest(t, ts, "GET", "/foo-abc.json", nil); body != "abc" {
13		t.Fatalf(body)
14	}
15}

I don't think the /foo-.json in line 9 matches the /foo-{suffix:[a-z]{2,3}}.json in line 3.
because "" does not satisfy [a-z]{2,3}.or what is the original purpose of this design.
this question is similar to #609.

@helios741
Copy link
Author

If it's a issue, I can fix it uniformly

helios741 added a commit to helios741/chi that referenced this issue Jul 13, 2021
helios741 added a commit to helios741/chi that referenced this issue Jul 13, 2021
helios741 added a commit to helios741/chi that referenced this issue Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants