Fix openapi base writer header code.

Signed-off-by: zhanluxianshen <zhanluxianshen@163.com>
This commit is contained in:
zhanluxianshen 2024-10-15 06:59:44 +08:00
parent 5dd0477fd4
commit 544dbeae62
No known key found for this signature in database
GPG Key ID: BEBCFB39E2C75D73

View File

@ -579,7 +579,7 @@ func (w *BaseWriter) writeError(code int, data []byte) (int, error) {
}
w.ResponseWriter.Header().Set("Content-Type", "application/json")
err = json.NewEncoder(w.ResponseWriter).Encode(NewError(http.StatusInternalServerError, serr.Error()))
err = json.NewEncoder(w.ResponseWriter).Encode(NewError(code, serr.Error()))
if err != nil {
return 0, err
}