Skip to content

Commit 5feaa5b

Browse files
committed
Fix typo options.header is not a documented option +
Fix - do not modify the options.headers object
1 parent 7b9f509 commit 5feaa5b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

+4-4
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)