spacewander commented on a change in pull request #70:
URL:
https://github.com/apache/apisix-go-plugin-runner/pull/70#discussion_r819238102
##########
File path: internal/http/request.go
##########
@@ -162,13 +163,34 @@ func (r *Request) Var(name string) ([]byte, error) {
return v, nil
}
+func (r *Request) Body() ([]byte, error) {
+ if r.body == nil {
+ r.body = []byte{}
Review comment:
We don't need to allocate, len(nil) already == 0.
##########
File path: internal/http/request.go
##########
@@ -162,13 +163,34 @@ func (r *Request) Var(name string) ([]byte, error) {
return v, nil
}
+func (r *Request) Body() ([]byte, error) {
+ if r.body == nil {
+ r.body = []byte{}
+ }
+
+ if len(r.body) > 0 {
+ return r.body, nil
+ }
+
+ builder := util.GetBuilder()
+ ei.ReqBodyStart(builder)
+ bodyInfo := ei.ReqBodyEnd(builder)
+ v, err := r.askExtraInfo(builder, ei.InfoReqBody, bodyInfo)
+ if err != nil {
+ return nil, err
+ }
Review comment:
Missing updating the r.body?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]