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
When sending a request without a content type or with an invalid content type it gives an error correctly through schema validation. BUt the status code is 400. Ideally it should 415 because the content type is invalid.
{
"code": "400",
"message": "Bad Request",
"description": "Schema validation failed in the Request: Request Content-Type header '[text/plain; charset=ISO-8859-1]' does not match any allowed types. Must be one of: [application/json; charset=utf-8]., "
}
Steps to Reproduce
Send a request with an invalid content type
Affected Component
APIM
Version
4.4.0-RC2
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response
The text was updated successfully, but these errors were encountered:
This issue could be reproduced. Receiving a 400 Bad Request status code is the default behaviour for schema validation.
But, when schema validation is disabled, it correctly responds with a 415 Unsupported Media Type error for requests with an invalid Content-Type header.
Because of this, there is a confusion whether the Content-Type header validation should occur before schema validation, resulting in a 415 Unsupported Media Type error being returned first, even when schema validation is enabled.
When sending a request with an invalid or empty Content-Type header:
When schema validation is disabled, throws a 415 Unsupported Media Type error.
When schema validation is enabled, throws a 400 Bad Request error because content-type header validation happens as part of the schema validation process. This is the expected behaviour and changing the status code would alter this.
Description
When sending a request without a content type or with an invalid content type it gives an error correctly through schema validation. BUt the status code is 400. Ideally it should 415 because the content type is invalid.
Steps to Reproduce
Send a request with an invalid content type
Affected Component
APIM
Version
4.4.0-RC2
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response
The text was updated successfully, but these errors were encountered: