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

Switch to Gorilla mux #3343

Closed
wants to merge 5 commits into from
Closed

Switch to Gorilla mux #3343

wants to merge 5 commits into from

Conversation

raphael
Copy link
Member

@raphael raphael commented Sep 8, 2023

Gorilla supports a few useful additional features like the ability to retrieve the path template at runtime.

Copy link
Member

@saniales saniales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@saniales
Copy link
Member

saniales commented Sep 8, 2023

Which kind of version bump are we going to do? v3.4.x?

http/mux.go Outdated
enc.Encode(NewErrorResponse(ctx, fmt.Errorf("404 page not found")))
}
return &mux{r}
r := mux.NewRouter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs NotFoundHandler, right?

Suggested change
r := mux.NewRouter()
r := mux.NewRouter()
r.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
ctx := context.WithValue(req.Context(), AcceptTypeKey, req.Header.Get("Accept"))
enc := ResponseEncoder(ctx, w)
w.WriteHeader(http.StatusNotFound)
enc.Encode(NewErrorResponse(ctx, fmt.Errorf("404 page not found")))
})

After feedback from the community and reviewing
potential router candidates, chi seems to be a great
default choice.
@raphael
Copy link
Member Author

raphael commented Sep 9, 2023

After discussions on the slack channel and considering various alternatives chi seems like a better fit. Closing this PR in favor of #3346.

@raphael raphael closed this Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants