Method returns the HTTP request method for the context, optionally overridden by the provided argument. If no override is given or if the provided override is not a valid HTTP method, it returns the current method from the context. Otherwise, it updates the context's method and returns the overridde
(override ...string)
| 819 | // If no override is given or if the provided override is not a valid HTTP method, it returns the current method from the context. |
| 820 | // Otherwise, it updates the context's method and returns the overridden method as a string. |
| 821 | func (r *DefaultReq) Method(override ...string) string { |
| 822 | app := r.c.app |
| 823 | if len(override) == 0 { |
| 824 | // Nothing to override, just return current method from context |
| 825 | return app.method(r.c.methodInt) |
| 826 | } |
| 827 | |
| 828 | method := utilsstrings.ToUpper(override[0]) |
| 829 | methodInt := app.methodInt(method) |
| 830 | if methodInt == -1 { |
| 831 | // Provided override does not valid HTTP method, no override, return current method |
| 832 | return app.method(r.c.methodInt) |
| 833 | } |
| 834 | r.c.methodInt = methodInt |
| 835 | return method |
| 836 | } |
| 837 | |
| 838 | // MultipartForm parse form entries from binary. |
| 839 | // This returns a map[string][]string, so given a key, the value will be a string slice. |