Skip to content

Commit 026f8d8

Browse files
committed
Add lua-cjson module
1 parent 5e94b2d commit 026f8d8

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

flavors.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
],
1919
"lua_modules": [
2020
"tsuru-rpaasv2 INOTIFY_INCDIR=/usr/include/linux-gnu",
21-
"lua-resty-http 0.17.2-0"
21+
"lua-resty-http 0.17.2-0",
22+
"lua-cjson 2.1.0.10-1"
2223
]
2324
},
2425
{

test/nginx-tsuru.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test_lua_content() {
2626

2727
test_lua_http_resty() {
2828
response=$(curl --fail --silent --show-error http://localhost:8080/lua_http_resty)
29-
assert "Proxyied response: nginx config check ok" "$response" "/lua_http_resty with expected response"
29+
assert '{"body":"nginx config check ok\n","proxied":true}' "$response" "/lua_http_resty with expected response"
3030
}
3131

3232
echo "Running tests"

test/nginx-tsuru.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ http {
6262
default_type 'text/plain';
6363

6464
content_by_lua_block {
65+
local cjson = require("cjson");
6566
local httpc = require("resty.http").new();
6667

6768
local res, err = httpc:request_uri("http://127.0.0.1:8080/", {
@@ -73,7 +74,7 @@ http {
7374
return
7475
end
7576

76-
ngx.say('Proxyied response: ' .. res.body)
77+
ngx.say(cjson.encode({proxied = true, body=res.body}))
7778

7879
}
7980
}

teste.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package.path = package.path .. ";/Users/wilson/.luarocks/share/lua/5.1/?.lua";
2+
package.cpath = package.cpath .. ";/Users/wilson/.luarocks/lib/lua/5.1/?.so";
3+
4+
local jwt = require('resty.jwt');

0 commit comments

Comments
 (0)