Home > Net >  Why should '400 Bad Request' not be repeated without a modification
Why should '400 Bad Request' not be repeated without a modification

Time:04-08

I was going through the MDN docs explaining the 400 Bad Request https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 and found a big warning sign reading Warning: The client should not repeat this request without modification.. They don't seem to give further explanation about this and searching on the internet wasn't fruitful. Could anyone explain what the consequences of this action would be if any?.

I don't believe retrying the request would be useful. However, I am curious as to why it is prohibited(The big red warning essentially implies that there 'could' be consequences for this, otherwise it wouldn't be the first thing you see when you open the page).

CodePudding user response:

A “bad request” means your request is not acceptable to the server. Feel free to repeat it 100 times, but it will always return status 400. And it is possible that the server doesn’t like wasting time on your bad requests and throttles you (not literally).

What you would not do is modify the request at runtime, but find out what a “good” request for the server looks like and change your code to send a good request in the first place.

(It may be possible that the URL is wrong, and the request is perfectly fine for the url it was intended for, but not the url it was sent to by mistake, that’s also something you change in your code).

  • Related