Skip to content

Commit 77db9e7

Browse files
authored
Do not take protocol and port from custom Endpoint (#1374)
1 parent 8b3d752 commit 77db9e7

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

.changeset/good-cheetahs-press.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/util-endpoints": patch
3+
---
4+
5+
Do not take protocol and port from custom Endpoint

packages/util-endpoints/src/__mocks__/test-cases/parse-url.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
"expect": {
7474
"endpoint": {
75-
"url": "http://http-99_ab.com-nopath.example.com"
75+
"url": "https://http-99_ab.com-nopath.example.com"
7676
}
7777
}
7878
},
@@ -83,7 +83,7 @@
8383
},
8484
"expect": {
8585
"endpoint": {
86-
"url": "http://http-99_ab-.com-nopath.example.com"
86+
"url": "https://http-99_ab-.com-nopath.example.com"
8787
}
8888
}
8989
},

packages/util-endpoints/src/resolveEndpoint.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ export const resolveEndpoint = (ruleSetObject: RuleSetObject, options: EndpointR
3636

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

39-
if (options.endpointParams?.Endpoint) {
40-
// take protocol and port from custom Endpoint if present.
41-
try {
42-
const givenEndpoint = new URL(options.endpointParams.Endpoint as string);
43-
const { protocol, port } = givenEndpoint;
44-
endpoint.url.protocol = protocol;
45-
endpoint.url.port = port;
46-
} catch (e) {
47-
// ignored
48-
}
49-
}
50-
5139
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
5240

5341
return endpoint;

0 commit comments

Comments
 (0)