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/12/07 02:28:44 UTC

[GitHub] [apisix] yunduansing opened a new issue, #8467: help request: I use go plugin runner write my own ext-plugin-post-resp: response-rewrite

yunduansing opened a new issue, #8467:
URL: https://github.com/apache/apisix/issues/8467

   ### Description
   
   pkgHTTP.Response.ReadBody() error: util/msg.go:56	read: truncated, only get the first 219260 bytes,but server.go receive rpc type: 101 data length: 6253172
   
   where can I find the read max bytes config and update it?
   
   my go code:
   `
   cfg := conf.(ResponseRewriteConf)
   	if cfg.Status > 0 {
   		w.WriteHeader(cfg.Status)
   	} else {
   		w.WriteHeader(200)
   	}
   
   	w.Header().Set("X-Resp-A6-Runner", "Go")
   	if len(cfg.Headers) > 0 {
   		for k, v := range cfg.Headers {
   			w.Header().Set(k, v)
   		}
   	}
   
   	//body := []byte(cfg.Body)
   	originBody, err := w.ReadBody()
   	if err != nil {
   		log.Errorf("failed to read response body: ", err)
   		return
   	}
   
   	var heleResp = HeleResponse{
   		ErrCode: w.StatusCode(),
   	}
   	if w.StatusCode() == 200 {
   		heleResp.Data = originBody
   	} else {
   		heleResp.ErrMsg = originBody
   	}
   
   	body, _ := json.Marshal(heleResp)
   
   	_, err = w.Write(body)
   	if err != nil {
   		log.Errorf("failed to write: %s", err)
   	}`
   
   ### Environment
   
   - APISIX version (run `apisix version`):3.0.0
   - Operating system (run `uname -a`):alpine
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org