Merge pull request #158 from ansien12/patch-1
Add a check to make sure provided secret is a string.
This commit is contained in:
commit
3128fdfee2
@ -112,6 +112,10 @@ function noQsMethod(options) {
|
|||||||
function authorize(options, onConnection) {
|
function authorize(options, onConnection) {
|
||||||
options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options);
|
options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options);
|
||||||
|
|
||||||
|
if (typeof options.secret !== 'string') {
|
||||||
|
throw new Error(`Provided secret "${options.secret}" is invalid, must be of type string.`)
|
||||||
|
}
|
||||||
|
|
||||||
if (!options.handshake) {
|
if (!options.handshake) {
|
||||||
return noQsMethod(options);
|
return noQsMethod(options);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user