Skip to content

Commit

Permalink
Do not take protocol and port from custom Endpoint (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Aug 27, 2024
1 parent 8b3d752 commit 77db9e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-cheetahs-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/util-endpoints": patch
---

Do not take protocol and port from custom Endpoint
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"expect": {
"endpoint": {
"url": "http://http-99_ab.com-nopath.example.com"
"url": "https://http-99_ab.com-nopath.example.com"
}
}
},
Expand All @@ -83,7 +83,7 @@
},
"expect": {
"endpoint": {
"url": "http://http-99_ab-.com-nopath.example.com"
"url": "https://http-99_ab-.com-nopath.example.com"
}
}
},
Expand Down
12 changes: 0 additions & 12 deletions packages/util-endpoints/src/resolveEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ export const resolveEndpoint = (ruleSetObject: RuleSetObject, options: EndpointR

const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });

if (options.endpointParams?.Endpoint) {
// take protocol and port from custom Endpoint if present.
try {
const givenEndpoint = new URL(options.endpointParams.Endpoint as string);
const { protocol, port } = givenEndpoint;
endpoint.url.protocol = protocol;
endpoint.url.port = port;
} catch (e) {
// ignored
}
}

options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);

return endpoint;
Expand Down

0 comments on commit 77db9e7

Please sign in to comment.