Workaround for node 4
This commit is contained in:
parent
8f2b55a7aa
commit
e66148fbb2
@ -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' });
|
||||
|
@ -1,3 +1,5 @@
|
||||
'use strict'; // Node 4.x workaround
|
||||
|
||||
const express = require('express');
|
||||
const http = require('http');
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
'use strict'; // Node 4.x workaround
|
||||
|
||||
const express = require('express');
|
||||
const http = require('http');
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
'use strict'; // Node 4.x workaround
|
||||
|
||||
const express = require('express');
|
||||
const http = require('http');
|
||||
|
||||
|
Reference in New Issue
Block a user