Can I set a custom text in a header HTTP/1.0, like this:
header("HTTP/1.0 400 Custom text for debugging);
instead of:
header("HTTP/1.0 400 Bad Request");
Could you tell me if it is valid?
Yes you can. But...
The reason why error codes and error messages exist is that so we can apply some standards in order to simplify the communication. That's the idea of a protocol - standards and rules in a conversation.
Now if we think, why there are both error codes and error messages, it might be that the messages are just a description of the code, meaning that if you changed it (without changing the error code) it would probably do no harm.
Still, this only depends on those who are communicating not depending on the http message, but instead on the code.
Having said these, I would go for an extra header instead of modifying an existing one. Just set a new header field for debugging.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments