spacewander commented on issue #3552:
URL: https://github.com/apache/apisix/issues/3552#issuecomment-774809665
I write a plugin to check it:
```
function _M.access(conf, ctx)
local req_body, err = core.request.get_body()
if not req_body then
return 503, {message = err}
end
local decoded, err = core.json.decode(req_body)
if not decoded then
return 503, {message = err}
end
ngx.log(ngx.WARN, "get key ", decoded.key)
return 200, decoded.key
end
```
And request it with this:
```
#!/usr/bin/env python
# coding: utf-8
# sudo pip install requests
import requests
resp = requests.put("http://127.0.0.1:9080/test", json={
"key": "key",
"value": "12345" * (1024 * 1024)
})
print(resp.status_code)
print(resp.text)
```
Then I get the result successfully:
```
2021/02/08 09:19:23 [warn] 1416#1416: *1248 a client request body is
buffered to a temporary file .../client_body_temp/0000000001, client:
127.0.0.1, server: , request: "PUT /test HTTP/1.1", host: "127.0.0.1:9080"
2021/02/08 09:19:23 [warn] 1416#1416: *1248 [lua] x.lua:55: phase_func():
get key key, client: 127.0.0.1, server: , request: "PUT /test HTTP/1.1", host:
"127.0.0.1:9080"
```
The wrong is in somewhere else.
----------------------------------------------------------------
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:
[email protected]