More explanation:
The following Accept Header Values are not valid and and generate a AcceptInvalidHeader object in WebOb. Being invalid WebOb discards the header and ends up defaulting the content type to application/json which then succeeds to process.
When we pass valid header syntax application/json;charset=utf-8 We get a AcceptValidHeader object in WebOb. Because this is valid syntax WebOb tries to match our explicitly defined content type application/json to the passed content type application/json;charset=utf-8. This matching happens without any processing on the header string.
More explanation:
The following Accept Header Values are not valid and and generate a AcceptInvalidHeader object in WebOb. Being invalid WebOb discards the header and ends up defaulting the content type to application/json which then succeeds to process.
application/ json;charset= json;charset json,charset= utf-8 utf-8;applicati on/json
application/
application/
charset=
When we pass valid header syntax application/ json;charset= utf-8 We get a AcceptValidHeader object in WebOb. Because this is valid syntax WebOb tries to match our explicitly defined content type application/json to the passed content type application/ json;charset= utf-8. This matching happens without any processing on the header string.
application/json != application/ json;charset= utf-8
Since these don't match we get exceptions that state we have passed an invalid content type and the request bails.