You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by co...@apache.org on 2025/07/25 21:45:35 UTC

(tinkerpop) branch 3.7-dev updated: CTR: TINKERPOP-3138 Fixed default `enableCompression` setting to be `false` instead of `undefined` in `gremlin-javascript`

This is an automated email from the ASF dual-hosted git repository.

colegreer pushed a commit to branch 3.7-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.7-dev by this push:
     new 9809784349 CTR: TINKERPOP-3138 Fixed default `enableCompression` setting to be `false` instead of `undefined` in `gremlin-javascript`
9809784349 is described below

commit 9809784349c95800985963222dd56ff0b0f90b95
Author: Cole-Greer <Co...@improving.com>
AuthorDate: Fri Jul 25 14:44:49 2025 -0700

    CTR: TINKERPOP-3138 Fixed default `enableCompression` setting to be `false` instead of `undefined` in `gremlin-javascript`
---
 CHANGELOG.asciidoc                                          |  1 +
 .../javascript/gremlin-javascript/lib/driver/connection.js  |  3 ++-
 .../javascript/gremlin-javascript/test/unit/client-test.js  | 13 +++++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8bfc9d22f4..273a9c5609 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -55,6 +55,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed bug in `CallStep` which prevented Java serialization due to non-serializable `ServiceCallContext` and `Service` usage.
 * Fixed bug in `Operator` which was caused only a single method parameter to be Collection type checked instead of all parameters.
 * Addded support for hot reloading of SSL certificates in Gremlin Server.
+* Fixed default `enableCompression` setting to be `false` instead of `undefined` in `gremlin-javascript`
 * Increased default `max_content_length`/`max_msg_size` in `gremlin-python` from 4MB to 10MB.
 * Added the `PopContaining` interface designed to get label and `Pop` combinations held in a `PopInstruction` object.
 * Fixed bug preventing a vertex from being dropped and then re-added in the same `TinkerTransaction`
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
index 96f82709fd..8e5d178639 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/connection.js
@@ -95,6 +95,7 @@ class Connection extends EventEmitter {
     this.traversalSource = options.traversalSource || 'g';
     this._authenticator = options.authenticator;
     this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
+    this._enableCompression = this.options.enableCompression || false;
   }
 
   /**
@@ -151,7 +152,7 @@ class Connection extends EventEmitter {
             pfx: this.options.pfx,
             rejectUnauthorized: this.options.rejectUnauthorized,
             agent: this.options.agent,
-            perMessageDeflate: this.options.enableCompression,
+            perMessageDeflate: this._enableCompression,
           }
         : undefined,
     );
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/client-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/client-test.js
index fee184fe69..9075bd4209 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/client-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/client-test.js
@@ -72,4 +72,17 @@ describe('Client', function () {
     customClient._connection = connectionMock;
     customClient.submit(query, null, {'evaluationTimeout': 123, 'materializeProperties': 'tokens'})
   });
+
+  it('should disable compression by default', function () {
+    const client = new Client('ws://localhost:9321');
+    assert.strictEqual(client._connection._enableCompression, false);
+  });
+
+  it('should passthrough compression setting', function () {
+    const uncompressedClient = new Client('ws://localhost:9321', {enableCompression: false});
+    const compressedClient = new Client('ws://localhost:9321', {enableCompression: true});
+
+    assert.strictEqual(uncompressedClient._connection._enableCompression, false);
+    assert.strictEqual(compressedClient._connection._enableCompression, true);
+  });
 });