-
Notifications
You must be signed in to change notification settings - Fork 37
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
Improve url handling #290
Conversation
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(/\/$/, '') : '/' |
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.
this (options.path.startsWith('/') ? '' : '/')
is redundant
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.
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?
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.
what I meant is you did these twice options.path ? (options.path.startsWith('/') ? '' : '/') + options.path.replace(/\/$/, '') : '/'
, nvm.
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.
(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
Fixes #284