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 2020/05/14 13:04:59 UTC

[GitHub] [incubator-apisix] xxm404 commented on issue #1559: The custom plug-in returns the result garbled

xxm404 commented on issue #1559:
URL: https://github.com/apache/incubator-apisix/issues/1559#issuecomment-628620910


   Hi @griffenliu can you give me a minimal reproducible example, I can not reproducible this problem
   In my test, the response normally
   
   my test code
   ```
   function _M.access(conf, ctx)
       -- core.log.warn("plugin access phase, conf : ", core.json.encode(conf))
       -- return 200, core.json.decode(data)
       local redis = redis_new()
       local ok, err = redis:connect('127.0.0.1', 6379)
       if not ok then
           return false, err
       end
       local data = redis:get('data')
       core.log.warn(">>>>>>>>>>>>>>>", data)
       return 200, core.json.decode(data)
   end
   ```
   log
   ```
   2020/05/14 13:02:55 [warn] 17681#17681: *332 [lua] example-plugin.lua:70: phase_fun(): >>>>>>>>>>>>>>>{"data":"测试服务器8001"}, client: 127.0.0.1, server: , request: "GET /api/bench/testSimple HTTP/1.1", host: "127.0.0.1:9080"
   ```
   response
   ```
   HTTP/1.1 200 OK
   Date: Thu, 14 May 2020 13:04:23 GMT
   Content-Type: text/plain
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX web server
   
   {"data":"测试服务器8001"}
   ```


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

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