fix(http): fix the correct response

pull/10616/head
Kelvin Wang 2018-12-07 10:07:38 -05:00
parent 8d546ff689
commit ee6b149c79
1 changed files with 6 additions and 1 deletions

View File

@ -123,7 +123,12 @@ func EncodeError(ctx context.Context, err error, w http.ResponseWriter) {
w.Header().Set(PlatformErrorCodeHeader, code)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(httpCode)
b, _ := json.Marshal(pe)
b, _ := json.Marshal(&platform.Error{
Code: code,
Op: platform.ErrorOp(pe),
Msg: platform.ErrorMessage(pe),
Err: pe.Err,
})
_, _ = w.Write(b)
return
}