consumes
with mime type parameters blocks all content types
#136
Labels
consumes
with mime type parameters blocks all content types
#136
What I See
Setting a parameter in the mime type (e.g.
charset=utf-8
intext/plain;charset=utf-8
) inside theconsumes
field in the swagger file ends up not matching any request.You get the error
even if the client content type is set to
text/plain; charset=utf-8
Sample swagger consumes line:
What I think is happening
It looks like the problem is that we're doing a string match of the parsed request mime type (
text/plain
), against the "allowed" mime types (text/plain; charset=utf-8
)runtime/middleware/validation.go
Line 45 in 3d6572c
I talked briefly with @casualjim on slack and his opinion on this is:
So it seems like the behavior should be changed to
text/plain
and server acceptstext/plain;charset=utf-8
text/plain;blah=true
and server acceptstext/plain;charset=utf-8
text/plain;charset=utf-8
and server acceptstext/plain
text/plain;charset=utf-8
and server acceptstext/plain;charset=utf-8
text/plain;charset=utf-8
and server acceptstext/plain;charset=ascii
I'll try and submit a patch for this when I get a chance.
The text was updated successfully, but these errors were encountered: