Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Jan 31, 2024
1 parent 88e1061 commit 9e0ee50
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 31 deletions.
10 changes: 0 additions & 10 deletions gateway/src/apicast/upstream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@ function _M:resolve()
return res
end

--- Return port to use when connecting to upstream.
--- @treturn number port number
function _M:port()
if not self or not self.uri then
return nil, 'not initialized'
end

return self.uri.port or resty_url.default_port(self.uri.scheme)
end

local root_uri = {
['/'] = true,
[''] = true,
Expand Down
6 changes: 0 additions & 6 deletions spec/proxy_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ describe('Proxy', function()
local get_upstream
before_each(function() get_upstream = proxy.get_upstream end)

it('sets correct upstream port', function()
assert.same(443, get_upstream({ api_backend = 'https://example.com' }):port())
assert.same(80, get_upstream({ api_backend = 'http://example.com' }):port())
assert.same(8080, get_upstream({ api_backend = 'http://example.com:8080' }):port())
end)

it("on invalid api_backend return error", function()
local upstream, err = get_upstream({ api_backend = 'test.com' })
assert.falsy(upstream)
Expand Down
15 changes: 0 additions & 15 deletions spec/upstream_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,6 @@ describe('Upstream', function()
end)
end)

describe(':port', function()
it('returns port from the URI', function()
assert.same(8090, Upstream.new('http://host:8090'):port())
end)

it('returns default port for the scheme when none is provided', function()
assert.same(443, Upstream.new('https://example.com'):port())
end)

it('returns nil when port is unknown', function()
assert.is_nil(Upstream.new('ftp://example.com'):port())
end)
end)


describe(':append_path', function()
it('return valid path when is not set', function()
local up = Upstream.new('http://host:8090')
Expand Down

0 comments on commit 9e0ee50

Please sign in to comment.