Skip to content

fix(api): port is repeated when port is not standard #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ Release process:
1. upload using: `VERSION=x.y.z APIKEY=abc... make upload`
1. test installing the rock from LuaRocks

### 1.1.0 (04-Nov-2022)
### 1.1.1 (21-Nov-2022)

- fix: port is repeated when port is not standard [#39](https://github.com/Kong/lua-resty-aws/pull/39)

### 1.1.0 (18-Nov-2022)

- fix: template handling of query string [#36](https://github.com/Kong/lua-resty-aws/pull/36)
- fix: blob param should be in raw body [#36](https://github.com/Kong/lua-resty-aws/pull/36)
Expand Down
4 changes: 4 additions & 0 deletions spec/02-requests/02-build_request_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe("operations protocol", function()
headers = {
["X-Sooper-Secret"] = "towel",
["X-Amz-Target"] = "sts.AssumeRole",
["Host"] = "sts.amazonaws.com",
},
method = 'POST',
path = '/hello%20world/42',
Expand Down Expand Up @@ -183,6 +184,7 @@ describe("operations protocol", function()
["Content-Length"] = 152,
["Content-Type"] = "application/x-amz-json-1.0",
["X-Amz-Target"] = "sts.AssumeRole",
["Host"] = "sts.amazonaws.com",
},
method = 'POST',
path = '/hello%20world/42',
Expand Down Expand Up @@ -221,6 +223,7 @@ describe("operations protocol", function()
["Content-Length"] = 152,
["Content-Type"] = "application/x-amz-json-1.0",
["X-Amz-Target"] = "sts.AssumeRole",
["Host"] = "sts.amazonaws.com",
},
method = 'POST',
path = '/hello%20world/42',
Expand Down Expand Up @@ -275,6 +278,7 @@ describe("operations protocol", function()
["Content-Length"] = 424,
["Content-Type"] = "application/xml",
["X-Amz-Target"] = "sts.AssumeRole",
["Host"] = "sts.amazonaws.com",
},
method = 'POST',
path = '/hello%20world/42',
Expand Down
6 changes: 3 additions & 3 deletions src/resty/aws/request/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ local function get_host_port(config)
end
end

return host_header, port
return host, port, host_header
end

-- implement AWS api protocols.
Expand All @@ -128,13 +128,13 @@ local function build_request(operation, config, params)
local http = operation.http or {}
local uri = http.requestUri or ""

local host, port = get_host_port(config)
local host, port, host_header = get_host_port(config)

local request = {
path = uri,
method = http.method,
query = {},
headers = {},
headers = { ["Host"] = host_header, },
host = host,
port = port,
}
Expand Down