Skip to content

Commit 0643597

Browse files
committed
Merge branch 'fix-headers-option' of https://github.com/simov/node-jsonwebtoken into simov-fix-headers-option
2 parents dd8969e + 5feaa5b commit 0643597

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ JWT.decode = function (jwt, options) {
3838
JWT.sign = function(payload, secretOrPrivateKey, options) {
3939
options = options || {};
4040

41-
var header = ((typeof options.headers === 'object') && options.headers) || {};
41+
var header = {};
4242

4343
if (typeof payload === 'object') {
4444
header.typ = 'JWT';
4545
}
4646

4747
header.alg = options.algorithm || 'HS256';
4848

49-
if (options.header) {
50-
Object.keys(options.header).forEach(function (k) {
51-
header[k] = options.header[k];
49+
if (options.headers) {
50+
Object.keys(options.headers).forEach(function (k) {
51+
header[k] = options.headers[k];
5252
});
5353
}
5454

0 commit comments

Comments
 (0)