I\'m communicating with an API that I can not change that sends a 400 response when a request is not validated on the API side. It is a valid HTTP request, but the request data
Try that way:
if (this.responseCode == HttpURLConnection.HTTP_OK) { inputStream = httpUrlConnection.getInputStream(); } else { inputStream = httpUrlConnection.getErrorStream(); }