-
Notifications
You must be signed in to change notification settings - Fork 67
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
Use port from endpoint url to create HttpRequestOptions: fix for 594 #595
base: main
Are you sure you want to change the base?
Conversation
src/dispatch/DataPlaneClient.ts
Outdated
@@ -114,6 +114,11 @@ export class DataPlaneClient { | |||
const options = { | |||
method: METHOD, | |||
protocol: this.config.endpoint.protocol, | |||
port: | |||
!this.config.endpoint.port || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we can simplify lines 117-118. Otherwise, looks great! Thank you
src/dispatch/DataPlaneClient.ts
Outdated
@@ -114,6 +114,11 @@ export class DataPlaneClient { | |||
const options = { | |||
method: METHOD, | |||
protocol: this.config.endpoint.protocol, | |||
port: | |||
!this.config.endpoint.port || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there coverage for this line?
Not sure what the point of !this.config.endpoint.port
is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answered above
src/dispatch/DataPlaneClient.ts
Outdated
port: | ||
!this.config.endpoint.port || | ||
isNaN(parseInt(this.config.endpoint.port, 10)) | ||
? undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there test coverage for when the port is not a number, and becomes undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost all the other tests are for the use-case where port is not set and I have added one where port is set. I cannot add a case for invalid port because URL class does not allow that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added couple of more tests to specifically test when port is not set and validated it against the code without my change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm providing @williazz concerns are addressed
This is fix for #594 .
These options are used to create HttpRequest (
aws-rum-web/src/dispatch/DataPlaneClient.ts
Line 76 in 032a9f5
aws-rum-web/src/dispatch/FetchHttpHandler.ts
Line 70 in 032a9f5