Skip to content

Commit

Permalink
fix(pdk) ngx.request_uri can be nil
Browse files Browse the repository at this point in the history
This came out while reviewing the zipkin plugin. I was not able to
reproduce the problem in our tests. It certainly does not hurt to have
the extra `or ""` anyway
  • Loading branch information
kikito committed Oct 17, 2018
1 parent 378252e commit 5ef4583
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kong/pdk/request.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ local function new(self)
function _REQUEST.get_path()
check_phase(PHASES.request)

local uri = ngx.var.request_uri
local uri = ngx.var.request_uri or ""
local s = find(uri, "?", 2, true)
return s and sub(uri, 1, s - 1) or uri
end
Expand All @@ -298,7 +298,7 @@ local function new(self)
-- kong.request.get_raw_path_and_query() -- "/v1/movies?movie=foo"
function _REQUEST.get_raw_path_and_query()
check_phase(PHASES.request)
return ngx.var.request_uri
return ngx.var.request_uri or ""
end

---
Expand Down

0 comments on commit 5ef4583

Please sign in to comment.