Skip to content

Commit

Permalink
Merge pull request #9 from HUK-COBURG/dependabot/go_modules/github.co…
Browse files Browse the repository at this point in the history
…m/getkin/kin-openapi-0.62.0

Bump github.com/getkin/kin-openapi from 0.61.0 to 0.62.0
  • Loading branch information
crissi98 authored May 27, 2021
2 parents d9b062f + 45f6cc4 commit 1e4fc2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/huk-coburg/openapirouter
go 1.15

require (
github.com/getkin/kin-openapi v0.61.0
github.com/getkin/kin-openapi v0.62.0
github.com/go-openapi/swag v0.19.15 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/stretchr/testify v1.7.0
Expand Down
6 changes: 4 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ func (router *Router) ServeHTTP(writer http.ResponseWriter, request *http.Reques
}
handler, ok := router.implementations[route]
if ok {
err = openapi3filter.ValidateRequest(context.Background(), &openapi3filter.RequestValidationInput{
validationInput := &openapi3filter.RequestValidationInput{
Request: request,
PathParams: pathParams,
QueryParams: request.URL.Query(),
Route: route,
Options: handler.options,
})
}
err = openapi3filter.ValidateRequest(request.Context(), validationInput)
if err != nil {
switch typedErr := err.(type) {
case *openapi3filter.RequestError:
Expand All @@ -75,6 +76,7 @@ func (router *Router) ServeHTTP(writer http.ResponseWriter, request *http.Reques
response.write(writer)
return
}
request = validationInput.Request
ctx := context.WithValue(request.Context(), pathParamsKey, pathParams)
handler.ServeHTTP(writer, request.WithContext(ctx))
} else {
Expand Down

0 comments on commit 1e4fc2b

Please sign in to comment.