Skip to content

Commit 9809784

Browse files
committed
CTR: TINKERPOP-3138 Fixed default enableCompression setting to be false instead of undefined in gremlin-javascript
1 parent 1ef460a commit 9809784

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
5555
* Fixed bug in `CallStep` which prevented Java serialization due to non-serializable `ServiceCallContext` and `Service` usage.
5656
* Fixed bug in `Operator` which was caused only a single method parameter to be Collection type checked instead of all parameters.
5757
* Addded support for hot reloading of SSL certificates in Gremlin Server.
58+
* Fixed default `enableCompression` setting to be `false` instead of `undefined` in `gremlin-javascript`
5859
* Increased default `max_content_length`/`max_msg_size` in `gremlin-python` from 4MB to 10MB.
5960
* Added the `PopContaining` interface designed to get label and `Pop` combinations held in a `PopInstruction` object.
6061
* Fixed bug preventing a vertex from being dropped and then re-added in the same `TinkerTransaction`

gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class Connection extends EventEmitter {
9595
this.traversalSource = options.traversalSource || 'g';
9696
this._authenticator = options.authenticator;
9797
this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
98+
this._enableCompression = this.options.enableCompression || false;
9899
}
99100

100101
/**
@@ -151,7 +152,7 @@ class Connection extends EventEmitter {
151152
pfx: this.options.pfx,
152153
rejectUnauthorized: this.options.rejectUnauthorized,
153154
agent: this.options.agent,
154-
perMessageDeflate: this.options.enableCompression,
155+
perMessageDeflate: this._enableCompression,
155156
}
156157
: undefined,
157158
);

gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/client-test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,17 @@ describe('Client', function () {
7272
customClient._connection = connectionMock;
7373
customClient.submit(query, null, {'evaluationTimeout': 123, 'materializeProperties': 'tokens'})
7474
});
75+
76+
it('should disable compression by default', function () {
77+
const client = new Client('ws://localhost:9321');
78+
assert.strictEqual(client._connection._enableCompression, false);
79+
});
80+
81+
it('should passthrough compression setting', function () {
82+
const uncompressedClient = new Client('ws://localhost:9321', {enableCompression: false});
83+
const compressedClient = new Client('ws://localhost:9321', {enableCompression: true});
84+
85+
assert.strictEqual(uncompressedClient._connection._enableCompression, false);
86+
assert.strictEqual(compressedClient._connection._enableCompression, true);
87+
});
7588
});

0 commit comments

Comments
 (0)