1
0
Fork 0
forked from forgejo/forgejo

[Vendor] update go-swagger v0.21.0 -> v0.25.0 (#12670)

* Update go-swagger

* vendor
This commit is contained in:
6543 2020-09-01 16:01:23 +02:00 committed by GitHub
parent 66843f2237
commit 3270e7a443
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
350 changed files with 26353 additions and 5552 deletions

View file

@ -20,8 +20,9 @@ import (
"strings"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/swag"
"github.com/go-openapi/runtime"
)
type validation struct {
@ -115,7 +116,10 @@ func (v *validation) contentType() {
}
func (v *validation) responseFormat() {
if str, rCtx := v.context.ResponseFormat(v.request, v.route.Produces); str == "" && runtime.HasBody(v.request) {
// if the route provides values for Produces and no format could be identify then return an error.
// if the route does not specify values for Produces then treat request as valid since the API designer
// choose not to specify the format for responses.
if str, rCtx := v.context.ResponseFormat(v.request, v.route.Produces); str == "" && len(v.route.Produces) > 0 {
v.request = rCtx
v.result = append(v.result, errors.InvalidResponseFormat(v.request.Header.Get(runtime.HeaderAccept), v.route.Produces))
}