-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why required request headers e.g. strings - are not treated as missing if they are blank? #28200
Comments
The header is indeed considered present but without a value. In the case where type conversion is required, it can "hide" the original empty value, and hence the change in 5.3 with #23939. We could improve the Javadoc for this. |
As to the question, why empty is not treated as missing, it really depends on your use case and perspective. There have been many discussions on the subject, and changing behavior will only lead to regressions for others. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Hello
When I read the below comments I understand that if a header is blank it is treated as missing regardless of thinking of the Key-Value concept.
For example, when we request a string header, even it is a blank string the controller does not respond as a bad request.
if the header is missing in the request
, maybe I am assuming for this condition that a blank string does not mean missing header?I wish we could somehow mention that regardless of the value it checks only the presence of the key of the header.
spring-framework/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestHeader.java
Lines 63 to 71 in 0cbea29
Disclosure:
I am aware of Spring 5.3+, for type conversions it works very well, but in my case is without type conversion. i.e. requesting string header and no type conversion.
The text was updated successfully, but these errors were encountered: