vardius / gorouter

Go Server/API micro framework, HTTP request router, multiplexer, mux
https://rafallorenz.com/gorouter
MIT License
154 stars 17 forks source link

Context params missing #17

Closed mar1n3r0 closed 4 years ago

mar1n3r0 commented 4 years ago

Tested in all middleware scenarios.

func Hello(w http.ResponseWriter, r *http.Request) {
    params, _ := context.Parameters(r.Context())
    fmt.Fprintf(w, "params: %v\n", params)
    fmt.Fprintf(w, "hello, %s!\n", params.Value("name"))
}

URL mock:

http://localhost:8080/hello/test

output:

params: [] hello, !

Context package imported as suggested with:

export GO111MODULE=on
go get -u -v github.com/vardius/gorouter/v4/context
mar1n3r0 commented 4 years ago

Fixed as per: GO111MODULE with Go 1.13