Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create 400 bad request so that I can verify a feature

Tags:

http

currently I am doing a work to handle the 400 bad request status error. I am wondering how to create a request that server will return 400 status.

like image 363
Bowen Avatar asked May 21 '13 09:05

Bowen


People also ask

How do I trigger 400 Bad Request?

Sending large files to the server will trigger error 400. You may encounter a “400 Bad Request” error message if your request exceeds the file upload limit of the server. The simplest solution for this issue is to compress your files. You can resize the large file to fit the upload size limit of the server.

What is 400 Bad Request in REST API?

The 400 Bad request status code indicates that the server was unable to process the request due to invalid information sent by the client.

How do I fix 400 unauthorized error?

Execute ipconfig/flushdns from a Command Prompt to do this. Clear your browser cache: Another reason could be that your cached version of the page is still suffering from the 400 status code error. In your browser's History, you can clear your cache that would resolve this problem.


2 Answers

I found an easy way to generate 400 Bad Request Error:

Appending /% at the end of the URL should work for most websites.

For example:

http://abc.go.com/%
http://www.checkupdown.com/%
https://www.oath.com/%
https://www.apple.com/%

The above URLs generate the following page:

enter image description here

Note that this method doesn't work for ALL websites on the internet.

Since the server can decide what to do when seeing /%.

like image 158
Brian Avatar answered Oct 15 '22 06:10

Brian


A HTTP 400 error occurs due to bad syntax in the request.

To create a request that forces the server to return a 400 error, you can:

  1. Open a TCP connection to port 80 on your server
  2. Send junk
  3. Observe response.
like image 39
ose Avatar answered Oct 15 '22 05:10

ose