I\'m getting 400 errors trying to connect to a website.
How do I set the connection to display why the server is rejecting me?
try {
doc = Jsoup.connect(
400
means the request is malformed:
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
Fundamentally, what you need to do is form the request correctly. For instance, if you're sending request parameters and usual the unusual encoding, make sure they're all correctly URI-encoded.
How do I set the connection to display why the server is rejecting me?
Usually the body of the response will include more detail. Not always, it's not required, but it could provide insight into why the request was considered "malformed." If the body of the response does not include this information, there's no way other than just looking at the request you're sending to figure out why it's considered malformed.