We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b9f509 commit 5feaa5bCopy full SHA for 5feaa5b
index.js
@@ -38,17 +38,17 @@ JWT.decode = function (jwt, options) {
38
JWT.sign = function(payload, secretOrPrivateKey, options) {
39
options = options || {};
40
41
- var header = ((typeof options.headers === 'object') && options.headers) || {};
+ var header = {};
42
43
if (typeof payload === 'object') {
44
header.typ = 'JWT';
45
}
46
47
header.alg = options.algorithm || 'HS256';
48
49
- if (options.header) {
50
- Object.keys(options.header).forEach(function (k) {
51
- header[k] = options.header[k];
+ if (options.headers) {
+ Object.keys(options.headers).forEach(function (k) {
+ header[k] = options.headers[k];
52
});
53
54
0 commit comments