fix content type for fatal error
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
3ce74daa8e
commit
6debf95e34
6
rpc.go
6
rpc.go
@ -428,6 +428,9 @@ func requestPayload(r *http.Request) ([]byte, error) {
|
|||||||
func writeError(w http.ResponseWriter, r *http.Request, err error) {
|
func writeError(w http.ResponseWriter, r *http.Request, err error) {
|
||||||
ce := errors.Parse(err.Error())
|
ce := errors.Parse(err.Error())
|
||||||
|
|
||||||
|
// response content type
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
switch ce.Code {
|
switch ce.Code {
|
||||||
case 0:
|
case 0:
|
||||||
// assuming it's totally screwed
|
// assuming it's totally screwed
|
||||||
@ -440,9 +443,6 @@ func writeError(w http.ResponseWriter, r *http.Request, err error) {
|
|||||||
w.WriteHeader(int(ce.Code))
|
w.WriteHeader(int(ce.Code))
|
||||||
}
|
}
|
||||||
|
|
||||||
// response content type
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
|
||||||
|
|
||||||
// Set trailers
|
// Set trailers
|
||||||
if strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
|
if strings.Contains(r.Header.Get("Content-Type"), "application/grpc") {
|
||||||
w.Header().Set("Trailer", "grpc-status")
|
w.Header().Set("Trailer", "grpc-status")
|
||||||
|
Loading…
Reference in New Issue
Block a user