Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adoublef committed Mar 21, 2024
1 parent db8789a commit dbfa1a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/http/httputil/method_override.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import (
"net/http"
)

// MethodOverride is a higher order [http.handlerFunc] which allows the client
// to override a POST request with a PUT, PATCH or DELETE.
//
// A search query ("_method") can be used or header ("X-HTTP-Method-Override").
func MethodOverride(h http.Handler) http.Handler {
// https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.httpmethodoverrideextensions.usehttpmethodoverride?view=aspnetcore-8.0
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPost {
method := r.URL.Query().Get("_method")
Expand Down

0 comments on commit dbfa1a8

Please sign in to comment.