Closed ORESoftware closed 4 years ago
I am trying to set a custom header: https://stackoverflow.com/questions/60645804/golang-wont-let-me-set-custom-header
the header is being set here:
func (ctr *Controller) Routes(m *martini.ClassicMartini) { m.Get("/cp/health/check", common.AsJson, common.RequestTimer, ctr.SimpleJSONResponse) }
I tried setting it in common.AsJson:
func AsJson(res http.ResponseWriter) { //res.Header().Set("cp-auth-token", "eyJhbGciOiJIUzI1NiIs...vVfO3WmqYMHz9TiUXKas") res.Header().Set("Content-Type", "application/json") }
or in ctr.SimpleJSONResponse:
func (ctr *Controller) SimpleJSONResponse(c *common.CPContext, timer common.RequestTime) (int, interface{}) { res.Header().Set("cp-auth-token", "eyJhbGciOiJIUzI1NiIs...vVfO3WmqYMHz9TiUXKas") return ctr.GenericMarshal(200, HStatus{ HealthStatus: "ok", }) }
nothing seems to work :(
must be some other problem, but prob not martini
I am trying to set a custom header: https://stackoverflow.com/questions/60645804/golang-wont-let-me-set-custom-header
the header is being set here:
I tried setting it in common.AsJson:
or in ctr.SimpleJSONResponse:
nothing seems to work :(