Skip to content

Commit a15a6d0

Browse files
committed
Fix non-deterministic error in EOS body unmarshall
1 parent 1d87c93 commit a15a6d0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/epp/handlers/server.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,13 @@ func (s *StreamingServer) Process(srv extProcPb.ExternalProcessor_ProcessServer)
207207
// Message is buffered, we can read and decode.
208208
if v.RequestBody.EndOfStream {
209209
loggerTrace.Info("decoding")
210-
err = json.Unmarshal(body, &reqCtx.Request.Body)
211-
if err != nil {
210+
if errUnmarshal := json.Unmarshal(body, &reqCtx.Request.Body); errUnmarshal != nil {
212211
if logger.V(logutil.DEBUG).Enabled() {
213-
err = errutil.Error{Code: errutil.BadRequest, Msg: "Error unmarshaling request body: " + string(body)}
214-
} else {
215-
err = errutil.Error{Code: errutil.BadRequest, Msg: "Error unmarshaling request body"}
212+
logger.Info("Error unmarshaling request body", "body", string(body), "err", errUnmarshal)
213+
}
214+
err = errutil.Error{
215+
Code: errutil.BadRequest,
216+
Msg: "Error unmarshaling request body",
216217
}
217218
break
218219
}

0 commit comments

Comments
 (0)