MCPcopy
hub / github.com/gofiber/fiber / Method

Method Method

req.go:821–836  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
821func (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.

Callers

nothing calls this directly

Calls 2

methodMethod · 0.80
methodIntMethod · 0.80

Tested by

no test coverage detected