You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/03 01:32:16 UTC
[GitHub] [apisix-go-plugin-runner] spacewander commented on a change in pull request #70: feat(request): fetch request body support
spacewander commented on a change in pull request #70:
URL: https://github.com/apache/apisix-go-plugin-runner/pull/70#discussion_r818241094
##########
File path: internal/http/request.go
##########
@@ -162,6 +163,22 @@ func (r *Request) Var(name string) ([]byte, error) {
return v, nil
}
+func (r *Request) Body() ([]byte, error) {
+ if len(r.body) > 0 {
Review comment:
Need to reset r.body in Reset
##########
File path: internal/http/request.go
##########
@@ -162,6 +163,22 @@ func (r *Request) Var(name string) ([]byte, error) {
return v, nil
}
+func (r *Request) Body() ([]byte, error) {
+ 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
+ }
+
+ return v, err
Review comment:
```suggestion
return v, nil
```
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org