Skip to content

Commit

Permalink
verify clickhouse headers on test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
qizhendong committed Feb 14, 2022
1 parent 34f3dcb commit bc00ad3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apisix/plugins/clickhouse-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ local function send_http_data(conf, log_message)
.. tostring(port) .. "] " .. err
end

if url_decoded.scheme == "https" and conf.ssl_verify then
if url_decoded.scheme == "https" then
ok, err = httpc:ssl_handshake(true, host, conf.ssl_verify)
if not ok then
return false, "failed to perform SSL with host[" .. host .. "] "
Expand Down
8 changes: 7 additions & 1 deletion t/plugin/clickhouse-logger.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ add_block_preprocessor(sub {
ngx.req.read_body()
local data = ngx.req.get_body_data()
local headers = ngx.req.get_headers()
ngx.log(ngx.ERR, "clickhouse body: ", data)
ngx.log(ngx.WARN, "clickhouse body: ", data)
for k, v in pairs(headers) do
ngx.log(ngx.WARN, "clickhouse headers: " .. k .. ":" .. v)
end
ngx.say("ok")
}
}
Expand Down Expand Up @@ -213,4 +216,7 @@ GET /opentracing
opentracing
--- grep_error_log_out
"clickhouse body: INSERT INTO t FORMAT JSONEachRow"
"clickhouse headers: X-ClickHouse-Key:a"
"clickhouse headers: X-ClickHouse-User:default"
"clickhouse headers: X-ClickHouse-Database:default"
--- wait: 5

0 comments on commit bc00ad3

Please sign in to comment.