From e66148fbb24362af0cf13c80f3e153176c91f40c Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Mon, 14 Oct 2019 04:13:25 +0200 Subject: [PATCH] Workaround for node 4 --- lib/index.js | 5 +++++ test/fixture/index.js | 2 ++ test/fixture/namespace.js | 2 ++ test/fixture/secret_function.js | 2 ++ 4 files changed, 11 insertions(+) diff --git a/lib/index.js b/lib/index.js index 8fbe5dd..53cf7c7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,6 +7,7 @@ function noQsMethod (options) { options = xtend(defaults, options); return (socket) => { + 'use strict'; // Node 4.x workaround const server = this.server || socket.server; if (!server.$emit) { @@ -144,7 +145,9 @@ function authorize (options, onConnection) { const auth = xtend(defaults, options); return (socket, accept) => { + 'use strict'; // Node 4.x workaround let token, error; + const handshake = socket.handshake; const req = socket.request || socket; const authorization_header = (req.headers || {}).authorization; @@ -219,6 +222,8 @@ function authorize (options, onConnection) { } function getSecret (request, secret, token, callback) { + 'use strict'; // Node 4.x workaround + if (typeof secret === 'function') { if (!token) { return callback({ code: 'invalid_token', message: 'jwt must be provided' }); diff --git a/test/fixture/index.js b/test/fixture/index.js index 40a1384..2f77105 100644 --- a/test/fixture/index.js +++ b/test/fixture/index.js @@ -1,3 +1,5 @@ +'use strict'; // Node 4.x workaround + const express = require('express'); const http = require('http'); diff --git a/test/fixture/namespace.js b/test/fixture/namespace.js index 09379e4..f8e5f8f 100644 --- a/test/fixture/namespace.js +++ b/test/fixture/namespace.js @@ -1,3 +1,5 @@ +'use strict'; // Node 4.x workaround + const express = require('express'); const http = require('http'); diff --git a/test/fixture/secret_function.js b/test/fixture/secret_function.js index bd411cb..1ee17cd 100644 --- a/test/fixture/secret_function.js +++ b/test/fixture/secret_function.js @@ -1,3 +1,5 @@ +'use strict'; // Node 4.x workaround + const express = require('express'); const http = require('http');