Passing custom header to http.TimeoutHandler


Currently there is no way to override content type header of http.TimeoutHandler hence writing a JSON message is not rendered nor the Content Type header is set as JSON. Is there a way to solve this issue somehow?

It is also mentioned here but ignored.


This is always a text content type in response.

func TimeoutHandler(timeout time.Duration) func(next http.Handler) http.Handler {
 	return func(next http.Handler) http.Handler {
 		return http.TimeoutHandler(next, timeout, `{"key":"value"}`)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.