You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting a parameter in the mime type (e.g. charset=utf-8 in text/plain;charset=utf-8) inside the consumes field in the swagger file ends up not matching any request.
You get the error
{"code":415,"message":"unsupported media type \"text/plain\", only [text/plain; charset=utf-8] are allowed"}
even if the client content type is set to text/plain; charset=utf-8
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)
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: