Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rest/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func adapterFunc(handler HandlerFunc) http.HandlerFunc {
request := &Request{
origRequest,
nil,
"",
map[string]interface{}{},
}

Expand Down
1 change: 1 addition & 0 deletions rest/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestWrapMiddlewares(t *testing.T) {
r := &Request{
nil,
nil,
"",
map[string]interface{}{},
}

Expand Down
3 changes: 3 additions & 0 deletions rest/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type Request struct {
// Map of parameters that have been matched in the URL Path.
PathParams map[string]string

// The PathExp of the route that is safisfying this request
PathExp string

// Environment used by middlewares to communicate.
Env map[string]interface{}
}
Expand Down
1 change: 1 addition & 0 deletions rest/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func defaultRequest(method string, urlStr string, body io.Reader, t *testing.T)
return &Request{
origReq,
nil,
"",
map[string]interface{}{},
}
}
Expand Down
3 changes: 2 additions & 1 deletion rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ func (rt *router) AppFunc() HandlerFunc {
return
}

// a route was found, set the PathParams
// a route was found, set the PathParams and PathExp
request.PathParams = params
request.PathExp = route.PathExp

// run the user code
handler := route.Func
Expand Down