apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
167 stars 69 forks source link

request help: how to rewrite request body? #136

Closed zxyao145 closed 8 months ago

zxyao145 commented 11 months ago

Issue description

How to rewrite request body?

Environment

yanmxa commented 8 months ago

Maybe you can do it by the following two steps:

  1. Add a method to the interface: SetBody(body []byte)
  2. Implement it in the default request
    func (r *Request) SetBody(body []byte) {
      r.body = body
    }
zxyao145 commented 8 months ago

Yes, and this is a new feature. https://github.com/apache/apisix/pull/9990

In the old version, although this API existed, it did not take effect.