Skip to content

Commit a2dea4e

Browse files
authored
docs(middleware): clarify MethodOverrideGetter return value (#3059)
* fix(middleware): normalize MethodOverride method to uppercase Overridden methods such as "delete" did not match router http.Method* constants. Trim and uppercase the override value before assigning. * docs(middleware): clarify MethodOverrideGetter return value Per review: do not normalize override methods in middleware. Document that Getter should return a standard method name (e.g. http.MethodDelete).
1 parent 548779a commit a2dea4e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

middleware/method_override.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ type MethodOverrideConfig struct {
1919
Getter MethodOverrideGetter
2020
}
2121

22-
// MethodOverrideGetter is a function that gets overridden method from the request
22+
// MethodOverrideGetter is a function that gets overridden method from the request.
23+
// The returned value should be a standard HTTP method name as used by net/http
24+
// (e.g. http.MethodDelete, "DELETE"). The middleware does not normalize case or
25+
// trim spaces — callers / Getter implementations should return a valid method.
2326
type MethodOverrideGetter func(c *echo.Context) string
2427

2528
// DefaultMethodOverrideConfig is the default MethodOverride middleware config.

0 commit comments

Comments
 (0)