File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ type ContextData interface {
2323 Del (key string ) error
2424}
2525
26-
2726// Params wraps a map[string]string and adds Get/Set/Del methods to work with it.
2827// Inspired on url.Values but simpler as it doesn't handles a map[string][]string
2928type Params map [string ]string
@@ -46,7 +45,6 @@ func (p Params) Del(key string) {
4645 delete (p , key )
4746}
4847
49-
5048// Context is the data/status storage of every YARF request.
5149// Every request will instantiate a new Context object and fill in with all the request data.
5250// Each request Context will be shared along the entire request life to ensure accesibility of its data at all levels.
@@ -62,8 +60,8 @@ type Context struct {
6260
6361 // Free storage to be used freely by apps to their convenience.
6462 Data ContextData
65-
66- // Matched Router storage used on Dispatch methods.
63+
64+ // Matched Router storage used on Dispatch methods.
6765 Route Router
6866}
6967
@@ -86,7 +84,7 @@ func (c *Context) Param(name string) string {
8684 return c .Params .Get (name )
8785}
8886
89- // StoreParams writes parts from requestParts that correspond with param names
87+ // StoreParams writes parts from requestParts that correspond with param names
9088// in routeParts into c.Params.
9189func (c * Context ) StoreParams (routeParts , requestParts []string ) {
9290 for i , p := range routeParts {
Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ func (r *route) Match(url string, c *Context) bool {
7373
7474 // It matches. Store route into Context.
7575 c .Route = r
76-
77- // Store params
76+
77+ // Store params
7878 c .StoreParams (r .routeParts , requestParts )
7979
8080 return true
@@ -162,8 +162,8 @@ func (g *GroupRoute) Match(url string, c *Context) bool {
162162 // Now look for a match inside the routes collection
163163 for _ , r := range g .routes {
164164 if r .Match (rURL , c ) {
165- // Store group prefix params
166- c .StoreParams (g .routeParts , urlParts )
165+ // Store group prefix params
166+ c .StoreParams (g .routeParts , urlParts )
167167 return true
168168 }
169169 }
@@ -271,8 +271,8 @@ func removeEmpty(parts []string) []string {
271271func matches (routeParts , requestParts []string ) bool {
272272 // Check for catch-all wildcard
273273 if len (routeParts ) > 0 && routeParts [len (routeParts )- 1 ] == "*" {
274- if len (requestParts ) < len (routeParts ) - 1 {
275- return false
274+ if len (requestParts ) < len (routeParts )- 1 {
275+ return false
276276 }
277277 } else if len (requestParts ) < len (routeParts ) {
278278 return false
You can’t perform that action at this time.
0 commit comments