Skip to content

Commit de26265

Browse files
committed
Small cleanup around url parsing
1 parent b857656 commit de26265

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/v1/internal/url-util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import ParsedUrl from 'url-parse';
2121
import {assertString} from './util';
2222
import {DEFAULT_PORT} from './ch-config';
2323

24-
export class Url {
24+
class Url {
2525

2626
constructor(scheme, host, port, hostAndPort, query) {
2727
/**
@@ -72,7 +72,7 @@ function parseBoltUrl(url) {
7272
const rawHost = extractHost(parsedUrl.hostname); // has square brackets for IPv6
7373
const host = unescapeIPv6Address(rawHost); // no square brackets for IPv6
7474
const port = extractPort(parsedUrl.port);
75-
const hostAndPort = port ? `${rawHost}:${port}` : rawHost;
75+
const hostAndPort = `${rawHost}:${port}`;
7676
const query = parsedUrl.query;
7777

7878
return new Url(scheme, host, port, hostAndPort, query);

test/v1/driver.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ describe('driver', () => {
321321
testIPv6Connection('bolt://[::1]', done);
322322
});
323323

324-
it('should connect to IPv6 address wit port', done => {
324+
it('should connect to IPv6 address with port', done => {
325325
testIPv6Connection('bolt://[::1]:7687', done);
326326
});
327327

@@ -331,7 +331,7 @@ describe('driver', () => {
331331
done();
332332
}
333333

334-
driver = neo4j.driver('bolt://[::1]', sharedNeo4j.authToken);
334+
driver = neo4j.driver(url, sharedNeo4j.authToken);
335335

336336
const session = driver.session();
337337
session.run('RETURN 42').then(result => {

0 commit comments

Comments
 (0)