An answer from the app without a Content-Type reaches the client without one (closes #127)
check / check (push) Waiting to run

Go's server adds a Content-Type it guesses from the body when the
response's headers have no Content-Type key, which happened to some
of the app's answers and not others, as the first part of the body or
the headers went out first. When the app sends none, smallwebwaf now
sets the key with no value on the client's response, which sends none.

Model: opus-5-5
This commit was merged in pull request #148.
This commit is contained in:
2026-10-20 16:41:18 +02:00
parent d1d21a0469
commit 69178da59a
3 changed files with 92 additions and 0 deletions
+7
View File
@@ -431,6 +431,13 @@ func (rq *request) modifyResponse(res *http.Response) error {
return errResponseTooLarge
}
// Go's server adds a Content-Type it guesses from the body to a
// response whose headers have no Content-Type key. The key with no
// value sends none, as the app sent none.
if res.Header.Get("Content-Type") == "" {
rq.out.Header()["Content-Type"] = nil
}
res.Body = &responseBody{body: limitBody(res.Body, maxBytes), rq: rq}
rq.startClientResponseTimeout()