Skip to content

Commit

Permalink
Closing #305; improving distribution build file
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Jun 6, 2015
1 parent 809292c commit fb05b65
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
6 changes: 5 additions & 1 deletion distributions/.build-package-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ tar xzf LuaJIT-$LUAJIT_VERSION.tar.gz
cd LuaJIT-$LUAJIT_VERSION
make
make install DESTDIR=$OUT
sudo make install # Install also on the build system
if [ "$(uname)" = "Darwin" ]; then
sudo make install
else
make install # Install also on the build system
fi
cd $OUT

# Install LuaRocks
Expand Down
2 changes: 1 addition & 1 deletion kong/cli/utils/signal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function _M.send_signal(args_config, signal)

if signal == STOP and success then
if IO.file_exists(kong_config.pid_file) then
os.execute("while [ -f "..kong_config.pid_file.." ]; do sleep 0.1; done")
os.execute("while [ -f "..kong_config.pid_file.." ]; do sleep 0.5; done")
end
end

Expand Down
6 changes: 3 additions & 3 deletions kong/plugins/response_transformer/body_filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ function _M.execute(conf)

local is_json_body = get_content_type() == APPLICATION_JSON

if (conf.add.json or conf.remove.json) and is_json_body then
if ((conf.add and conf.add.json) or (conf.remove and conf.remove.json)) and is_json_body then
local json_body = read_json_body()
if json_body then

if conf.add.json then
if conf.add and conf.add.json then
iterate_and_exec(conf.add.json, function(name, value)
local v = cjson.encode(value)
if stringy.startswith(v, "\"") and stringy.endswith(v, "\"") then
Expand All @@ -77,7 +77,7 @@ function _M.execute(conf)
end)
end

if conf.remove.json then
if conf.remove and conf.remove.json then
iterate_and_exec(conf.remove.json, function(name)
json_body[name] = nil
end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("Response Transformer Plugin #proxy", function()
spec_helper.insert_fixtures {
api = {
{ name = "tests response_transformer", public_dns = "response.com", target_url = "http://httpbin.org" },
{ name = "tests response_transformer 2", public_dns = "response2.com", target_url = "http://httpbin.org" },
},
plugin_configuration = {
{
Expand All @@ -28,6 +29,15 @@ describe("Response Transformer Plugin #proxy", function()
}
},
__api = 1
},
{
name = "response_transformer",
value = {
add = {
headers = {"Cache-Control:max-age=86400"}
}
},
__api = 2
}
}
}
Expand Down Expand Up @@ -62,8 +72,14 @@ describe("Response Transformer Plugin #proxy", function()
assert.are.equal("newvalue", body["newjsonparam"])
end)

it("should add new headers", function()
local body, status, headers = http_client.get(STUB_GET_URL, {}, {host = "response2.com"})
assert.are.equal(200, status)
assert.are.equal("max-age=86400", headers["cache-control"])
end)

end)

describe("Test removing parameters", function()

it("should remove a header", function()
Expand All @@ -80,5 +96,5 @@ describe("Response Transformer Plugin #proxy", function()
end)

end)

end)

0 comments on commit fb05b65

Please sign in to comment.