Github user jorgebay commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/922#discussion_r214823388
--- Diff:
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
---
@@ -114,24 +114,26 @@ class DriverRemoteConnection extends RemoteConnection
{
result: null
};
}
- const message = bufferFromString(this._header +
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
+
+ const message = bufferFromString(this._header +
JSON.stringify(this._getRequest(requestId, bytecode, op, args, processor)));
this._ws.send(message);
}));
}
- _getRequest(id, bytecode, op, args) {
+ _getRequest(id, bytecode, op, args, processor) {
if (args) {
args = this._adaptArgs(args);
}
-
+
return ({
'requestId': { '@type': 'g:UUID', '@value': id },
'op': op || 'bytecode',
- 'processor': 'traversal',
+ // if using op eval need to ensure processor stays unset if caller
didn't set it.
+ 'processor': (!processor && op !== 'eval') ? 'traversal' : processor,
'args': args || {
- 'gremlin': this._writer.adaptObject(bytecode),
- 'aliases': { 'g': this.traversalSource }
- }
+ 'gremlin': this._writer.adaptObject(bytecode),
--- End diff --
NIT: Use 2 spaces instead of 4 in the following lines.
---