Skip to content

Commit 89d63b7

Browse files
authored
export Params field (#10)
1 parent 49dea4f commit 89d63b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

context.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type handlerFunc func(ctx *Context) error
1212

1313
type Context struct {
1414
RequestCtx *fasthttp.RequestCtx
15-
params map[string]string
15+
Params map[string]string
1616
paramValues []string
1717
handlers []handlerFunc
1818
handlerIdx int
@@ -36,7 +36,7 @@ type Cookie struct {
3636
func NewContext(ctx *fasthttp.RequestCtx, params map[string]string) *Context {
3737
return &Context{
3838
RequestCtx: ctx,
39-
params: params,
39+
Params: params,
4040
paramValues: make([]string, 0, 10),
4141
handlers: nil,
4242
handlerIdx: -1,
@@ -50,13 +50,13 @@ func (c *Context) Context() *fasthttp.RequestCtx {
5050

5151
// WithParams sets the params for the context.
5252
func (c *Context) WithParams(params map[string]string) *Context {
53-
c.params = params
53+
c.Params = params
5454
return c
5555
}
5656

5757
// Param returns the param value for the given key.
5858
func (c *Context) Param(key string) string {
59-
return c.params[key]
59+
return c.Params[key]
6060
}
6161

6262
// Query returns the query value for the given key.

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (r *Router) find(method, path string) []Handler {
6363
for _, route := range routes {
6464
if matches, params := route.match(path); matches {
6565
c := NewContext(nil, nil)
66-
c.params = params
66+
c.Params = params
6767
return r.applyMiddleware(route.Handlers, method)
6868
}
6969
}

0 commit comments

Comments
 (0)