Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-17 Thread Rajith Roshan
According to the http spec[1], it says status codes are extensible[2] unless it preserve it class (for ex: 4xx for client errors). I think we can define our own status code and add it in our documentation. For ex cloudflare(reverse proxy) sent 520 when it receives invalid response from origin serve

Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-17 Thread Malintha Amarasinghe
Taking from the RFC: 11.2 . 422 Unprocessable Entity The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and *

Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-16 Thread Sanjeewa Malalgoda
I do not think 422 is correct for issues with response. Usually 4XX errors used to indicate client/request errors. In this case its error or issue with backend. And for client it can consider as internal server error as well. Or we can indicate content related issue. 5XX response would be better. B

Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-15 Thread Harsha Kumara
+1 we should use 422. [1] https://www.quora.com/Which-HTTP-code-is-best-suited-for-validation-errors-400-or-422 [2] https://stackoverflow.com/questions/1959947/whats-an-appropriate-http-status-code-to-return-by-a-rest-api-service-for-a-val On Wed, Jan 9, 2019 at 3:22 PM Uvindra Dias Jayasinha wr

Re: [Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-14 Thread Uvindra Dias Jayasinha
I think 422 is the most appropriate given your use case of validating if a message matches a given schema. So you can receive a valid JSON or XML(it's not malformed hence it is not a bad request(400)), but it may not match with the message schema definition you are matching against. The specs dont

[Dev] Regarding the HTTP status code to be used if the response is invalid

2019-01-14 Thread Shalki Wenushika
Hi all, This is related to the mail thread subjected as “[Architecture]API schema based request/response validator for Microgateway”. I’m validating requests/responses coming to the microgateway and send error messages to the client if the request/response is invalid. When a client sends a reques