Skip to content

Commit a4a01cd

Browse files
Improve url handling
1 parent c5c3348 commit a4a01cd

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

lib/connection/connections/HttpConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default class HttpConnection implements IConnectionProvider {
9898

9999
this.connection = new ThriftHttpConnection(
100100
{
101-
url: `${options.https ? 'https' : 'http'}://${options.host.replace(/\/+$/, '')}:${options.port}${options.path ? ('/' + options.path.replace(/^\/+|\/+$/g, '')) : '/'}`,
101+
url: `${options.https ? 'https' : 'http'}://${options.host.replace(/\/$/, '')}:${options.port}${options.path ? ('/' + options.path.replace(/\/$/, '')) : '/'}`,
102102
transport: thrift.TBufferedTransport,
103103
protocol: thrift.TBinaryProtocol,
104104
getRetryPolicy: () => this.getRetryPolicy(),

tests/unit/connection/connections/HttpConnection.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ describe('HttpConnection.connect', () => {
150150
input: { host: 'xyz.com/', path: 'sql/v1' },
151151
expected: 'https://xyz.com:443/sql/v1'
152152
},
153-
{
154-
input: { host: 'xyz.com//', path: '//sql/v1//' },
155-
expected: 'https://xyz.com:443/sql/v1'
156-
},
157153
{
158154
input: { host: 'xyz.com', path: undefined },
159155
expected: 'https://xyz.com:443/'

0 commit comments

Comments
 (0)