Caddy plugin, can't set Content-Type of HTTP response


(Denis) #1

It looks like

log.Println("Content-Type must be application/json")
w.Header().Set("Content-Type", "application/json")

the message is printed still the output has content type text/plain charset=utf8. What can be wrong?


(Denis) #2

It was my fault, sorry for the noise.

I did everything in Go except HTTP services and didn’t know Header().Set(...) must precede WriteHeader


(system) #3

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