Questions tagged [bad-request]

HTTP status code 400, implying the request was not understood by the server and should not be redone without modifications.

641 questions
90
votes
1 answer

What is the cause of the Bad Request Error when submitting form in Flask application?

After reading many similar sounding problems and the relevant Flask docs, I cannot seem to figure out what is generating the following error upon submitting a form: 400 Bad Request The browser (or proxy) sent a request that this server could not…
zch
  • 3,020
  • 4
  • 26
  • 34
77
votes
7 answers

MVC Controller return a bad request?

I was wondering if it was possible to return a bad request with content from an MVC Controller? The only way I have been able to do this is to throw HttpException however here I can't set any content. Tried this approach to but for some odd reason I…
Dr Schizo
  • 4,045
  • 7
  • 38
  • 77
71
votes
7 answers

How to return 400 (Bad Request) on Flask?

I have created a simple flask app that and I'm reading the response from python as: response = requests.post(url,data=json.dumps(data), headers=headers ) data = json.loads(response.text) Now my issue is that under certain conditions I want to…
Luis Ramon Ramirez Rodriguez
  • 9,591
  • 27
  • 102
  • 181
32
votes
1 answer

Android HttpClient and HTTPS

I'm new to implementing HTTPS connections in Android. Essentially, I'm trying to connect to a server using the org.apache.http.client.HttpClient. I believe, at some point, I'll need to access the application's keystore in order to authorize my…
harrisonlee
  • 5,068
  • 4
  • 21
  • 20
32
votes
2 answers

Guzzle: handle 400 bad request

I'm using Guzzle in Laravel 4 to return some data from another server, but I can't handle Error 400 bad request [status code] 400 [reason phrase] Bad Request using: $client->get('http://www.example.com/path/'.$path, [ …
mwafi
  • 3,946
  • 8
  • 56
  • 83
29
votes
1 answer

Returning Empty ActionResult

I may encounter situations, when I need to just return bad request result. For example, there is a call to MVC 3 site's controllers action, but the required parameter is missing in a request uri. What do I return in response. I know I can do…
Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174
23
votes
2 answers

WebClient - get response body on error status code

I'm looking essentially for the same thing asked here: Any way to access response body using WebClient when the server returns an error? But no answers have been provided so far. The server returns a "400 bad request" status, but with a detailed…
SharpAffair
  • 5,558
  • 13
  • 78
  • 158
20
votes
3 answers

How to test a bad request in cypress

I am testing logging in POST method in cypress with incorrect credentials. this returns 400 bad requests which I need to test. This is what I have: describe('Login API Test - Correct user login', () => { it('Validate the header', () => { …
ashna naran
  • 379
  • 1
  • 5
  • 11
20
votes
4 answers

Tomcat is not redirecting to 400 bad request custom error page

We have tomcat 9 web server in production. The problem we are facing is we want to show the custom error page for our application if tomcat receives any malformed URL as follows http://URL/| or http://URL/[ I have added error page tag in web.xml…
Pawan Patil
  • 1,067
  • 5
  • 20
  • 46
17
votes
1 answer

Fix bad referer URLs

I recently notice bad URLs coming from external sites to my site. I get a lots of 404 not found from sites that reference my site using a bad link like: My site - http://www.example.com/mypage/CachedOnTuesdays My link should be:…
Erin Tucker
  • 3,274
  • 2
  • 15
  • 22
15
votes
2 answers

How to handle "OPTIONS *" request in nginx?

In my environment, I use perlbal to redirect request to nginx. If verify_backend is on. perbal will send a "OPTIONS *" request to nginx, but the nginx response it as a bad request. According to RFC2616: If the Request-URI is an asterisk (""), the…
Cody
  • 4,353
  • 4
  • 39
  • 42
14
votes
3 answers

Inconsistent behaviour with ModelState validation asp.net core api

I get an inconsistent behaviour when asp.net core api validates objects and when I manually add model errors and invoke BadRequest(ModelState) As an example, I have these 2 endpoints in my controller [HttpPost] public IActionResult Post(MyModel…
nicecatch
  • 1,687
  • 2
  • 21
  • 38
14
votes
6 answers

SendGrid API V3 returns 400 Bad Request

I am trying to achieve send of mail via SendGrid API. Following is the JSON I am sending as a body of the POST Method { "content" : [ { "type" : "text\/plain", "value" : "Hello, World!" } ], "personalizations" : [ { …
iOSer
  • 2,241
  • 1
  • 18
  • 26
14
votes
5 answers

Can't get error message on BadRequest in Web Api 2

I've googled a lot searching for an answer to my problem with no luck so, let's try if someone else can help me. I have a Web Api 2 action to register an user after doing some validations. If everything works, it return the serialized user and if…
Toni Moreno
  • 351
  • 1
  • 3
  • 8
13
votes
4 answers

Django | joined path is located outside of the base path component {% static img.thumbnail.url %}, Error 400 with whitenoise

I've finish my first app in Django and works perfectly, but still have pre-deployment problems since I set DEGUG=False ... Here is just to display an image in a template... T_T I was using this, but now it does'nt work when I use whitenoise to serve…
LauGau
  • 429
  • 1
  • 4
  • 14
1
2 3
42 43