mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <drchase@google.com> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
db3e02994c
commit
c0e149b6b1
1 changed files with 4 additions and 3 deletions
|
|
@ -2674,7 +2674,8 @@ func stripHostPort(h string) string {
|
||||||
// the path that will match after following the redirect.
|
// the path that will match after following the redirect.
|
||||||
//
|
//
|
||||||
// If there is no registered handler that applies to the request,
|
// If there is no registered handler that applies to the request,
|
||||||
// Handler returns a “page not found” handler and an empty pattern.
|
// Handler returns a “page not found” or “method not supported”
|
||||||
|
// handler and an empty pattern.
|
||||||
//
|
//
|
||||||
// Handler does not modify its argument. In particular, it does not
|
// Handler does not modify its argument. In particular, it does not
|
||||||
// populate named path wildcards, so r.PathValue will always return
|
// populate named path wildcards, so r.PathValue will always return
|
||||||
|
|
@ -2864,7 +2865,7 @@ func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) {
|
||||||
// always refers to user code.
|
// always refers to user code.
|
||||||
|
|
||||||
// Handle registers the handler for the given pattern.
|
// Handle registers the handler for the given pattern.
|
||||||
// If the given pattern conflicts, with one that is already registered, Handle
|
// If the given pattern conflicts with one that is already registered, Handle
|
||||||
// panics.
|
// panics.
|
||||||
func (mux *ServeMux) Handle(pattern string, handler Handler) {
|
func (mux *ServeMux) Handle(pattern string, handler Handler) {
|
||||||
if use121 {
|
if use121 {
|
||||||
|
|
@ -2875,7 +2876,7 @@ func (mux *ServeMux) Handle(pattern string, handler Handler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleFunc registers the handler function for the given pattern.
|
// HandleFunc registers the handler function for the given pattern.
|
||||||
// If the given pattern conflicts, with one that is already registered, HandleFunc
|
// If the given pattern conflicts with one that is already registered, HandleFunc
|
||||||
// panics.
|
// panics.
|
||||||
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
|
func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
|
||||||
if use121 {
|
if use121 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue