responseWriterDelegator
incorrectly handles 100 Continue
response
#1772
Labels
responseWriterDelegator
incorrectly handles 100 Continue
response
#1772
Description
100 Continue
response can be issued many times before an actual response is return (eg.200 OK
). In case ofpromhttp
these responses should be ignored.When you look at the
http/server.go
: https://github.com/golang/go/blob/go1.24.1/src/net/http/server.go#L1212-L1228 you can notice that they only setwroteHeader
variable orstatus
when it is not informational header.But here https://github.com/prometheus/client_golang/blob/v1.21.1/prometheus/promhttp/delegator.go#L55-L66 we don't filter
100 Continue
response.Therefore, when
100 Continue
is set and then there is no explicit200 OK
reported, then final status code will be100
and not200
as it should be.Steps To Reproduce
100 Continue
header as final status code instead of200 OK
.Expected behavior
200 OK
status code to be reported even when there is explicit100 Continue
done in the handler.Likely we need to do similar thing that they do in
http/server.go
which is to simply ignore informational headers if they are issued before a regular response.The text was updated successfully, but these errors were encountered: