Skip to content

Commit

Permalink
feat(core): fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Jan 18, 2024
1 parent b1ffcae commit 504c3a5
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions spec/02-integration/05-proxy/34-proxy_with_compress_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
local helpers = require "spec.helpers"

local TCP_PORT = helpers.get_available_port()


for _, strategy in helpers.each_strategy() do
describe("Proxy with compressor [#" .. strategy .. "]", function()

describe("[http] brotli", function()
local proxy_client
local proxy_ssl_client
lazy_setup(function()
local bp = helpers.get_db_utils(strategy, {
"routes",
"services",
"plugins",
})

local s0 = bp.services:insert {
name = "service0",
}

local r0 = bp.routes:insert {
paths = { "/0" },
service = s0,
}

assert(helpers.start_kong({
database = strategy,
nginx_conf = "spec/fixtures/custom_nginx.template",
nginx_proxy_brotli = "on",
nginx_proxy_brotli_comp_level = 6,
nginx_proxy_brotli_types = "text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js",
stream_listen = "off",
admin_listen = "off",
}))
end)

lazy_teardown(function()
helpers.stop_kong()
end)

before_each(function()
proxy_client = helpers.proxy_client()
proxy_ssl_client = helpers.proxy_ssl_client()
end)

after_each(function()
if proxy_client then
proxy_client:close()
end

if proxy_ssl_client then
proxy_ssl_client:close()
end
end)

it("header can be set when brotli compressor works fine", function()
local res = proxy_client:get("/0/xml", {
headers = {
["Accept-Encoding"] = "br",
["Content-Type"] = "application/xml",
}
})
assert.res_status(200, res)
assert.equal("br", res.headers["Content-Encoding"])
end)
end)
end)
end

0 comments on commit 504c3a5

Please sign in to comment.