mirror of https://github.com/dapr/go-sdk.git
move set header to top (#158)
This commit is contained in:
parent
ab924fba7d
commit
dea02bd1e3
|
|
@ -51,13 +51,13 @@ func (s *Server) AddServiceInvocationHandler(route string, fn func(ctx context.C
|
|||
|
||||
// write to response if handler returned data
|
||||
if o != nil && o.Data != nil {
|
||||
if o.ContentType != "" {
|
||||
w.Header().Set("Content-type", o.ContentType)
|
||||
}
|
||||
if _, err := w.Write(o.Data); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if o.ContentType != "" {
|
||||
w.Header().Set("Content-type", o.ContentType)
|
||||
}
|
||||
}
|
||||
})))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue