Skip to content

Commit c0e149b

Browse files
FiloSottilegopherbot
authored andcommitted
net/http: document that ServeMux.Handler can also synthetize a 405
Also, fix a minor typo in ServeMux.Handle and ServeMux.HandleFunc. Change-Id: I6a6a46565719104cb8f2484daf0e39f35b55a078 Reviewed-on: https://go-review.googlesource.com/c/go/+/675835 Reviewed-by: David Chase <[email protected]> Auto-Submit: Filippo Valsorda <[email protected]> Reviewed-by: Damien Neil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent db3e029 commit c0e149b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/net/http/server.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,8 @@ func stripHostPort(h string) string {
26742674
// the path that will match after following the redirect.
26752675
//
26762676
// If there is no registered handler that applies to the request,
2677-
// Handler returns a “page not found” handler and an empty pattern.
2677+
// Handler returns a “page not found” or “method not supported”
2678+
// handler and an empty pattern.
26782679
//
26792680
// Handler does not modify its argument. In particular, it does not
26802681
// populate named path wildcards, so r.PathValue will always return
@@ -2864,7 +2865,7 @@ func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) {
28642865
// always refers to user code.
28652866

28662867
// Handle registers the handler for the given pattern.
2867-
// If the given pattern conflicts, with one that is already registered, Handle
2868+
// If the given pattern conflicts with one that is already registered, Handle
28682869
// panics.
28692870
func (mux *ServeMux) Handle(pattern string, handler Handler) {
28702871
if use121 {
@@ -2875,7 +2876,7 @@ func (mux *ServeMux) Handle(pattern string, handler Handler) {
28752876
}
28762877

28772878
// HandleFunc registers the handler function for the given pattern.
2878-
// If the given pattern conflicts, with one that is already registered, HandleFunc
2879+
// If the given pattern conflicts with one that is already registered, HandleFunc
28792880
// panics.
28802881
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
28812882
if use121 {

0 commit comments

Comments
 (0)