Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve url handling #290

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 7 commits into from
Apr 14, 2025
Merged

Improve url handling #290

merged 7 commits into from
Apr 14, 2025

Conversation

vikrantpuppala
Copy link
Collaborator

Fixes #284

Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
Signed-off-by: Vikrant Puppala <[email protected]>
@@ -98,7 +98,9 @@ export default class HttpConnection implements IConnectionProvider {

this.connection = new ThriftHttpConnection(
{
url: `${options.https ? 'https' : 'http'}://${options.host}:${options.port}${options.path ?? '/'}`,
url: `${options.https ? 'https' : 'http'}://${options.host.replace(/\/$/, '')}:${options.port}${
options.path ? (options.path.startsWith('/') ? '' : '/') + options.path.replace(/\/$/, '') : '/'
Copy link
Collaborator

@jackyhu-db jackyhu-db Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this (options.path.startsWith('/') ? '' : '/') is redundant

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my thought was that sql warehouses have paths starting with / like /sql/1.0/warehouses/xxxxxx whereas all purpose clusters have paths without a starting / like sql/protocolv1/o/xxxxx/yyyyyy, why do you say this is redundant?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I meant is you did these twice options.path ? (options.path.startsWith('/') ? '' : '/') + options.path.replace(/\/$/, '') : '/', nvm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(options.path.startsWith('/') ? '' : '/') this would ensure that it has a / at the start and options.path.replace(/\/$/, '') : '/' would ensure that it has a / at the end

@vikrantpuppala vikrantpuppala merged commit 056ed0b into main Apr 14, 2025
7 of 8 checks passed
@vikrantpuppala vikrantpuppala deleted the improve-url-handling branch April 14, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Small Issue : efficient URI formation
3 participants