summaryrefslogtreecommitdiff
path: root/pkg/worker_handler/request.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/worker_handler/request.go')
-rw-r--r--pkg/worker_handler/request.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/worker_handler/request.go b/pkg/worker_handler/request.go
index 75ee8381..44c466bb 100644
--- a/pkg/worker_handler/request.go
+++ b/pkg/worker_handler/request.go
@@ -9,6 +9,7 @@ import (
"strings"
j "github.com/json-iterator/go"
+ "github.com/spiral/errors"
"github.com/spiral/roadrunner/v2/pkg/payload"
"github.com/spiral/roadrunner/v2/plugins/http/attributes"
"github.com/spiral/roadrunner/v2/plugins/http/config"
@@ -138,16 +139,17 @@ func (r *Request) Close(log logger.Logger) {
// Payload request marshaled RoadRunner payload based on PSR7 data. values encode method is JSON. Make sure to open
// files prior to calling this method.
func (r *Request) Payload() (payload.Payload, error) {
+ const op = errors.Op("marshal_payload")
p := payload.Payload{}
var err error
if p.Context, err = json.Marshal(r); err != nil {
- return payload.Payload{}, err
+ return payload.Payload{}, errors.E(op, errors.Encode, err)
}
if r.Parsed {
if p.Body, err = json.Marshal(r.body); err != nil {
- return payload.Payload{}, err
+ return payload.Payload{}, errors.E(op, errors.Encode, err)
}
} else if r.body != nil {
p.Body = r.body.([]byte)