mirror of https://github.com/gofiber/fiber.git
✏️ Fix typo (#2518)
* Fix: typo in client.go * Fix: typo in ctx.go * Fix: typo in path.go * Fix: typo in router.go * Fix: typo in adaptor.gopull/2520/head
parent
040aac94c6
commit
5967d36bc0
34
client.go
34
client.go
|
@ -78,50 +78,50 @@ type Client struct {
|
|||
JSONDecoder utils.JSONUnmarshal
|
||||
}
|
||||
|
||||
// Get returns a agent with http method GET.
|
||||
// Get returns an agent with http method GET.
|
||||
func Get(url string) *Agent { return defaultClient.Get(url) }
|
||||
|
||||
// Get returns a agent with http method GET.
|
||||
// Get returns an agent with http method GET.
|
||||
func (c *Client) Get(url string) *Agent {
|
||||
return c.createAgent(MethodGet, url)
|
||||
}
|
||||
|
||||
// Head returns a agent with http method HEAD.
|
||||
// Head returns an agent with http method HEAD.
|
||||
func Head(url string) *Agent { return defaultClient.Head(url) }
|
||||
|
||||
// Head returns a agent with http method GET.
|
||||
// Head returns an agent with http method GET.
|
||||
func (c *Client) Head(url string) *Agent {
|
||||
return c.createAgent(MethodHead, url)
|
||||
}
|
||||
|
||||
// Post sends POST request to the given url.
|
||||
// Post sends POST request to the given URL.
|
||||
func Post(url string) *Agent { return defaultClient.Post(url) }
|
||||
|
||||
// Post sends POST request to the given url.
|
||||
// Post sends POST request to the given URL.
|
||||
func (c *Client) Post(url string) *Agent {
|
||||
return c.createAgent(MethodPost, url)
|
||||
}
|
||||
|
||||
// Put sends PUT request to the given url.
|
||||
// Put sends PUT request to the given URL.
|
||||
func Put(url string) *Agent { return defaultClient.Put(url) }
|
||||
|
||||
// Put sends PUT request to the given url.
|
||||
// Put sends PUT request to the given URL.
|
||||
func (c *Client) Put(url string) *Agent {
|
||||
return c.createAgent(MethodPut, url)
|
||||
}
|
||||
|
||||
// Patch sends PATCH request to the given url.
|
||||
// Patch sends PATCH request to the given URL.
|
||||
func Patch(url string) *Agent { return defaultClient.Patch(url) }
|
||||
|
||||
// Patch sends PATCH request to the given url.
|
||||
// Patch sends PATCH request to the given URL.
|
||||
func (c *Client) Patch(url string) *Agent {
|
||||
return c.createAgent(MethodPatch, url)
|
||||
}
|
||||
|
||||
// Delete sends DELETE request to the given url.
|
||||
// Delete sends DELETE request to the given URL.
|
||||
func Delete(url string) *Agent { return defaultClient.Delete(url) }
|
||||
|
||||
// Delete sends DELETE request to the given url.
|
||||
// Delete sends DELETE request to the given URL.
|
||||
func (c *Client) Delete(url string) *Agent {
|
||||
return c.createAgent(MethodDelete, url)
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ func (a *Agent) String() (int, string, []error) {
|
|||
return code, utils.UnsafeString(body), errs
|
||||
}
|
||||
|
||||
// Struct returns the status code, bytes body and errors of url.
|
||||
// Struct returns the status code, bytes body and errors of URL.
|
||||
// And bytes body will be unmarshalled to given v.
|
||||
//
|
||||
// it's not safe to use Agent after calling [Agent.Struct]
|
||||
|
@ -889,7 +889,7 @@ func AcquireClient() *Client {
|
|||
|
||||
// ReleaseClient returns c acquired via AcquireClient to client pool.
|
||||
//
|
||||
// It is forbidden accessing req and/or its' members after returning
|
||||
// It is forbidden accessing req and/or it's members after returning
|
||||
// it to client pool.
|
||||
func ReleaseClient(c *Client) {
|
||||
c.UserAgent = ""
|
||||
|
@ -913,9 +913,9 @@ func AcquireAgent() *Agent {
|
|||
return a
|
||||
}
|
||||
|
||||
// ReleaseAgent returns a acquired via AcquireAgent to Agent pool.
|
||||
// ReleaseAgent returns an acquired via AcquireAgent to Agent pool.
|
||||
//
|
||||
// It is forbidden accessing req and/or its' members after returning
|
||||
// It is forbidden accessing req and/or it's members after returning
|
||||
// it to Agent pool.
|
||||
func ReleaseAgent(a *Agent) {
|
||||
a.reset()
|
||||
|
@ -942,7 +942,7 @@ func AcquireResponse() *Response {
|
|||
|
||||
// ReleaseResponse return resp acquired via AcquireResponse to response pool.
|
||||
//
|
||||
// It is forbidden accessing resp and/or its' members after returning
|
||||
// It is forbidden accessing resp and/or it's members after returning
|
||||
// it to response pool.
|
||||
// Copy from fasthttp
|
||||
func ReleaseResponse(resp *Response) {
|
||||
|
|
2
ctx.go
2
ctx.go
|
@ -904,7 +904,7 @@ func (c *Ctx) Next() error {
|
|||
// Increment handler index
|
||||
c.indexHandler++
|
||||
var err error
|
||||
// Did we executed all route handlers?
|
||||
// Did we execute all route handlers?
|
||||
if c.indexHandler < len(c.route.Handlers) {
|
||||
// Continue route stack
|
||||
err = c.route.Handlers[c.indexHandler](c)
|
||||
|
|
|
@ -27,7 +27,7 @@ func HTTPHandler(h http.Handler) fiber.Handler {
|
|||
}
|
||||
}
|
||||
|
||||
// ConvertRequest converts a fiber.Ctx to an http.Request.
|
||||
// ConvertRequest converts a fiber.Ctx to a http.Request.
|
||||
// forServer should be set to true when the http.Request is going to be passed to a http.Handler.
|
||||
func ConvertRequest(c *fiber.Ctx, forServer bool) (*http.Request, error) {
|
||||
var req http.Request
|
||||
|
|
8
path.go
8
path.go
|
@ -46,7 +46,7 @@ type routeSegment struct {
|
|||
|
||||
// different special routing signs
|
||||
const (
|
||||
wildcardParam byte = '*' // indicates a optional greedy parameter
|
||||
wildcardParam byte = '*' // indicates an optional greedy parameter
|
||||
plusParam byte = '+' // indicates a required greedy parameter
|
||||
optionalParam byte = '?' // concludes a parameter by name and makes it optional
|
||||
paramStarterChar byte = ':' // start character for a parameter with name
|
||||
|
@ -138,7 +138,7 @@ func RoutePatternMatch(path, pattern string, cfg ...Config) bool {
|
|||
|
||||
patternPretty := pattern
|
||||
|
||||
// Case sensitive routing, all to lowercase
|
||||
// Case-sensitive routing, all to lowercase
|
||||
if !config.CaseSensitive {
|
||||
patternPretty = utils.ToLower(patternPretty)
|
||||
path = utils.ToLower(path)
|
||||
|
@ -228,7 +228,7 @@ func addParameterMetaInfo(segs []*routeSegment) []*routeSegment {
|
|||
// check how often the compare part is in the following const parts
|
||||
if segs[i].IsParam {
|
||||
// check if parameter segments are directly after each other and if one of them is greedy
|
||||
// in case the next parameter or the current parameter is not a wildcard its not greedy, we only want one character
|
||||
// in case the next parameter or the current parameter is not a wildcard it's not greedy, we only want one character
|
||||
if segLen > i+1 && !segs[i].IsGreedy && segs[i+1].IsParam && !segs[i+1].IsGreedy {
|
||||
segs[i].Length = 1
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ func (routeParser *routeParser) getMatch(detectionPath, path string, params *[ma
|
|||
if !segment.IsParam {
|
||||
i = segment.Length
|
||||
// is optional part or the const part must match with the given string
|
||||
// check if the end of the segment is a optional slash
|
||||
// check if the end of the segment is an optional slash
|
||||
if segment.HasOptionalSlash && partLen == i-1 && detectionPath == segment.Const[:i-1] {
|
||||
i--
|
||||
} else if !(i <= partLen && detectionPath[:i] == segment.Const) {
|
||||
|
|
|
@ -184,7 +184,7 @@ func (app *App) handler(rctx *fasthttp.RequestCtx) { //revive:disable-line:confu
|
|||
func (app *App) addPrefixToRoute(prefix string, route *Route) *Route {
|
||||
prefixedPath := getGroupPath(prefix, route.Path)
|
||||
prettyPath := prefixedPath
|
||||
// Case sensitive routing, all to lowercase
|
||||
// Case-sensitive routing, all to lowercase
|
||||
if !app.config.CaseSensitive {
|
||||
prettyPath = utils.ToLower(prettyPath)
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ func (app *App) register(method, pathRaw string, group *Group, handlers ...Handl
|
|||
}
|
||||
// Create a stripped path in-case sensitive / trailing slashes
|
||||
pathPretty := pathRaw
|
||||
// Case sensitive routing, all to lowercase
|
||||
// Case-sensitive routing, all to lowercase
|
||||
if !app.config.CaseSensitive {
|
||||
pathPretty = utils.ToLower(pathPretty)
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ func (app *App) register(method, pathRaw string, group *Group, handlers ...Handl
|
|||
}
|
||||
|
||||
func (app *App) registerStatic(prefix, root string, config ...Static) {
|
||||
// For security we want to restrict to the current work directory.
|
||||
// For security, we want to restrict to the current work directory.
|
||||
if root == "" {
|
||||
root = "."
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ func (app *App) registerStatic(prefix, root string, config ...Static) {
|
|||
if prefix[0] != '/' {
|
||||
prefix = "/" + prefix
|
||||
}
|
||||
// in case sensitive routing, all to lowercase
|
||||
// in case-sensitive routing, all to lowercase
|
||||
if !app.config.CaseSensitive {
|
||||
prefix = utils.ToLower(prefix)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue