confluentinc/kafka-rest

Status Code is 200 despite a bad request

christophelannoyadeo opened this issue · 1 comments

Dear all,
when using Rest Proxy and made a mistake on producing the message updon the Avro, the APi send a status Code 200.
Inside the bdoy response, we found the detail of the error. Example:
{
"error_code": 400,
"message": "Bad Request: Expected start-union. Got VALUE_STRING"
}

Wil it it not beeter to send a statu code 4XX instaed of 200 ?

Thanks in advance for exchange

I assume this is a v3 Produce request (POST .../v3/clusters/.../topics/.../records). If so, the reason it works like this is that the request can handle many records, each of which has its own status code.

As a result, your request was status code 200, but the status code for the message was 400.

If you have continued the request by supplying another message which was valid as part of the same POST request, that would have received a status code of 200.