Skip to content

context doesn't capture "Group" params #49

Closed
@tve

Description

@tve

The request params that are part of the Group prefix are not captured correctly. Here's a test program:

package main

import (
        "fmt"

        "github.com/labstack/echo"
)

func main() {
        e := echo.New()
        gr := e.Group("/acct/:a")
        gr.Get("/hello", helloHandler)
        e.Run(":4444")
}

func helloHandler(c *echo.Context) {
        c.String(200, fmt.Sprintf("Hello World!\nacct: %s\n%#v\n", c.Param("acct"), *c))
}

and a simple test:

2$ go run main.go &
[1] 1485
tve@h:/home/src/github.com/rightscale/uca/bug2$ curl http://localhost:4444/acct/123/hello
Hello World!
acct:
echo.Context{Request:(*http.Request)(0xc2080325b0), Response:(*echo.response)(0xc20803ac90), pnames:[]string(nil), pvalues:[]string{"123", "", "", "", ""}, store:echo.store{}, echo:(*echo.Echo)(0xc208066080)}

You can see that the 'acct' param is empty, but in the context the value of the param was captured but not the name. Am I doing something wrong?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions