Fix content-length header assertion

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Kevin Pollet 2025-01-31 12:00:05 +01:00 committed by GitHub
parent 4fd6b10b7d
commit cdd24e91b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 4 deletions

View File

@ -179,7 +179,6 @@ func (c *conn) handleResponse(r rwWithUpgrade) error {
} }
res.Reset() res.Reset()
res.Header.Reset()
res.Header.SetNoDefaultContentType(true) res.Header.SetNoDefaultContentType(true)
continue continue
@ -216,7 +215,7 @@ func (c *conn) handleResponse(r rwWithUpgrade) error {
return nil return nil
} }
hasContentLength := res.Header.Peek("Content-Length") != nil hasContentLength := len(res.Header.Peek("Content-Length")) > 0
if hasContentLength && res.Header.ContentLength() == 0 { if hasContentLength && res.Header.ContentLength() == 0 {
return nil return nil

View File

@ -307,8 +307,6 @@ func TestHeadRequest(t *testing.T) {
} }
func TestNoContentLengthResponse(t *testing.T) { func TestNoContentLengthResponse(t *testing.T) {
t.Skip("Waiting for a fix")
backendListener, err := net.Listen("tcp", ":0") backendListener, err := net.Listen("tcp", ":0")
require.NoError(t, err) require.NoError(t, err)