Repository: tinkerpop Updated Branches: refs/heads/master d1a3fa147 -> 626773fb9
Pass custom headers to the websocket connection In order to authorize to the gremlin server (in this case AWS Neptune) i need to pass custom headers for authorization to the service. the PR will allow to send any headers (like an API key or signature) and pass them to the Websocket function. While there can be many use cases for this, in my case i pass the Authorization & x-amz-date required for Signature V4 (IAM) authentication. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/54ad5f45 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/54ad5f45 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/54ad5f45 Branch: refs/heads/master Commit: 54ad5f45e73bae05b957b89539cb6a61d557f445 Parents: abfe968 Author: Lior Pollack <deejvi...@gmail.com> Authored: Mon Sep 10 22:16:38 2018 +0300 Committer: Jorge Bay Gondra <jorgebaygon...@gmail.com> Committed: Thu Sep 27 12:58:44 2018 +0200 ---------------------------------------------------------------------- .../gremlin-javascript/lib/driver/driver-remote-connection.js | 2 ++ 1 file changed, 2 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/54ad5f45/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js ---------------------------------------------------------------------- diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js index 15836ba..ca059cf 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js @@ -49,12 +49,14 @@ class DriverRemoteConnection extends RemoteConnection { * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'. * @param {GraphSONWriter} [options.writer] The writer to use. * @param {Authenticator} [options.authenticator] The authentication handler to use. + * @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request. * @constructor */ constructor(url, options) { super(url); options = options || {}; this._ws = new WebSocket(url, { + headers: options.headers, ca: options.ca, cert: options.cert, pfx: options.pfx,