Skip to content

Commit 8d9b4ed

Browse files
committed
Fix user agent string
It previously was `neo4j-javascript/[object Object]` because of an incorrect usage of default import. This commit makes it `neo4j-javascript/0.0.0-dev`. Part after `/` will be changed by the pre-release gulp script.
1 parent fd1c85f commit 8d9b4ed

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/v1/driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Driver {
4545
* @param {Object} config
4646
* @access private
4747
*/
48-
constructor(url, userAgent = 'neo4j-javascript/0.0', token = {}, config = {}) {
48+
constructor(url, userAgent, token = {}, config = {}) {
4949
this._url = url;
5050
this._userAgent = userAgent;
5151
this._openSessions = {};

src/v1/routing-driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Integer from './integer'
2929
*/
3030
class RoutingDriver extends Driver {
3131

32-
constructor(url, userAgent = 'neo4j-javascript/0.0', token = {}, config = {}) {
32+
constructor(url, userAgent, token = {}, config = {}) {
3333
super(url, userAgent, token, config);
3434
this._clusterView = new ClusterView(new RoundRobinArray([url]));
3535
}

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
// This is set up this way to keep the version in the code in
2525
// sync with the npm package version, and to allow the build
2626
// system to control version names at packaging time.
27-
export default { VERSION : "0.0.0-dev" };
27+
export default "0.0.0-dev";

test/v1/driver.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ describe('driver', function() {
142142
driver.session();
143143
});
144144

145+
it('should have correct user agent', () => {
146+
const directDriver = neo4j.driver("bolt://localhost");
147+
expect(directDriver._userAgent).toBe("neo4j-javascript/0.0.0-dev");
148+
directDriver.close();
149+
150+
const routingDriver = neo4j.driver("bolt+routing://localhost");
151+
expect(routingDriver._userAgent).toBe("neo4j-javascript/0.0.0-dev");
152+
routingDriver.close();
153+
});
154+
145155
var exposedTypes = [
146156
'Node',
147157
'Path',

0 commit comments

Comments
 (0)