Skip to content

Commit

Permalink
feat(pdk): add an option to skip fetching req/resp headers
Browse files Browse the repository at this point in the history
THIS IS AN INTERNAL ONLY FLAG TO SKIP FETCHING HEADERS,
AND THIS FLAG WILL BE REMOVED IN THE FUTURE
WITHOUT ANY NOTICE AND DEPRECATION.
  • Loading branch information
ADD-SP committed Jun 6, 2024
1 parent 5478b01 commit 203fcdf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions kong/pdk/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,15 @@ do
end
end

local request_headers, response_headers = nil, nil
-- THIS IS AN INTERNAL ONLY FLAG TO SKIP FETCHING HEADERS,
-- AND THIS FLAG WILL BE REMOVED IN THE FUTURE
-- WITHOUT ANY NOTICE AND DEPRECATION.
if not options.__skip_fetch_headers__ then
request_headers = okong_request.get_headers()
response_headers = ongx.resp.get_headers()
end

local upstream_status = var.upstream_status or ctx.buffered_status or ""

local response_source = okong.response.get_source(ongx.ctx)
Expand All @@ -836,15 +845,15 @@ do
url = url,
querystring = okong_request.get_query(), -- parameters, as a table
method = okong_request.get_method(), -- http method
headers = okong_request.get_headers(),
headers = request_headers,
size = to_decimal(var.request_length),
tls = build_tls_info(var, ctx.CLIENT_VERIFY_OVERRIDE),
},
upstream_uri = upstream_uri,
upstream_status = upstream_status,
response = {
status = ongx.status,
headers = ongx.resp.get_headers(),
headers = response_headers,
size = to_decimal(var.bytes_sent),
},
latencies = {
Expand Down

0 comments on commit 203fcdf

Please sign in to comment.