Closed panta closed 3 years ago
I understand. This is because WriteHeader is called before all headers are set (compare with https://github.com/golang/go/issues/17083).
I think the ResultWriter needs to write the status code as well. Otherwise we will need to split the functionality into multiple functions or there will be ordering issues. The develop branch has a fix for this.
This doesn't happen with unit tests, maybe there is a difference when using
httptest
? With a real handler I get the response with atext/plain
Content-Type. I guess this is because the status is emitted before the Content-Type (ultimately set here).