Closed
Description
Tarantool upstream module: v2.5-rc2-docker-dirty
Tarantool: 1.7.5-88-g1f73658
Nginx upstream module produces malformed JSON in case of tnt_multireturn_skip_count 2; tnt_pure_result on;
How to reproduce
- use lua and config provided
- GET http://localhost:9191/
Expected response:
{"data": {}, "code": 200, "message","hello"}
Actual response (malformed JSON):
{"data":"code","200":"message","hello":}
init.lua
box.cfg({
listen=3301
})
box.once('gr', function()
box.schema.user.grant('guest', 'read,write,execute', 'universe')
end)
function httpRequestHandler(req, ...)
return {
code=200,
message="hello",
data={}
}
end
Config
... some code ommited
upstream test {
server 127.0.0.1:3301 max_fails=1 fail_timeout=1s;
keepalive 10;
}
server {
listen 9191 default;
server_name tnt_test;
location / {
tnt_pass test;
tnt_method "httpRequestHandler";
add_header 'Content-Type' 'application/json; charset=utf-8;';
tnt_pass_http_request on parse_args;
tnt_http_rest_methods all;
tnt_http_methods all;
tnt_multireturn_skip_count 2;
tnt_pure_result on;
}
}
... some code ommited
Another examples:
This produces incorrect JSON too:
{
code=200,
message="hello",
data={1,2}
}
-> {"data":1,"2":"code","200":"message"}
This lua-table leads to correct JSON:
{
code=200,
message="hello",
data={a=1, b=2}
}
-> {"data":{"a":1,"b":2},"code":200,"message":"hello"}