-
Notifications
You must be signed in to change notification settings - Fork 546
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
HEAD requests content-length is not based on the body as per the http… #896
base: master
Are you sure you want to change the base?
Conversation
boolean addContentLengthHeader = true; | ||
if ("HEAD".equalsIgnoreCase(request.getMethod())) { | ||
addContentLengthHeader = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to get this as an enum? Feels like a string equality check is a little weak... Otherwise, this feels better anyway:
boolean addContentLengthHeader = !"HEAD".equalsIgnoreCase(request.getMethod());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree enum is more cleaner way to do the check, but its not available in the repo without introducing additional dependencies.
Simplified the conditional statement as per the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
… spec. Fixing it to not override the content-length if the request is HEADER type
… spec. Fixing it to not override the content-length if the request is HEADER type
734075a
to
a647e7c
Compare
HEAD requests content-length is not based on the body as per the http spec. Fixing it to not override the content-length if the request is HEADER type