If we get Http BAD request 400 error, the problem is surely from our request. Check the endpoint, body, setHeader() and so on.
1. Check the URL.
2. Try HTTP instead of HTTPS and vice versa.
3. The response body will tell you more information. So, use getBody() to find what is the information the body is getting from the URL.
4. Check whether the URL has any blank space.