http.EncodeJSONResponse body writing is not compatible with net/http
Open
bug
- Dominant language
- Go
- Stars
- 27.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
### What did you do?
1. Implemented http.StatusCoder() which returns 304 (Not Modified)
2. Observed an error when http.EncodeJSONResponse is called: `http: request method or response status code does not allow body`
It seems that body is not written only on 204: https://github.com/go-kit/kit/blob/master/transport/http/server.go#L177
However, stdlib defines "no body allowed" as 100-199, 204, 304: https://cs.opensource.google/go/go/+/refs/tags/go1.22.3:src/net/http/transfer.go;l=460
### What did you expect?
No error.
### What happened instead?
Got an error.
Contributor guide
Assessment
This issue has not been assessed yet.