Closed moinologics closed 2 months ago
@moinologics I tested this with socat, seems like gin internally strips the body if the verb was HEAD, so this code produces a compliant behavior (except dynamically generated JSON should not have a content-length on HEAD). However I still think this is not ideal, we shouldn't rely on undocumented error-catching features and write code with a looks-wrong semantics.
Feel free to @ jmattheis for a second opinion :) Everybody has different styles and preferences
Here's a solution I think is robust, (maybe even a little overkill?) , but at the very least I think connection, content type and content-encoding must be the same, and content length must not be present.
https://github.com/gotify/server/commit/b43e7cdc8ccdea2c09042704c05f5c3561e96d1f
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 80.46%. Comparing base (
a58b0be
) to head (2e0210d
). Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Fixes #687