Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when http client recieve a http.StatusBadRequest response (e.g. due t…
…o misconfigured OPA server) the response body is not a parsablble JSON, and hence instead of returning the JSON parser error, we need to return an actual response body containing the reason for the error. e.g. in case of OPA error the ATC server response body will never be a parsable JSON and instead its string (byte) starting with: > policy check error: reason This will always be unparsable by the JSON parser used in the HTTP client and instead of returning JSON parser error from the client itself (`invalid character 'p' looking for beginning of value`) we want to return the respons body error msg returned by the ATC server. This is especially important e.g. when a OPA server is misconfigured. Instead of: > error: invalid character 'p' looking for beginning of value end user will see: > error: Unexpected Response > Status: 400 Bad Request > Body: policy check error: reason Signed-off-by: aliculPix4D <[email protected]>
- Loading branch information