You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
577 B

  1. var jwt = require('../index');
  2. var expect = require('chai').expect;
  3. describe('set header', function() {
  4. it('should add the header', function () {
  5. var token = jwt.sign({foo: 123}, '123', { header: { foo: 'bar' } });
  6. var decoded = jwt.decode(token, {complete: true});
  7. expect(decoded.header.foo).to.equal('bar');
  8. });
  9. it('should allow overriding header', function () {
  10. var token = jwt.sign({foo: 123}, '123', { header: { alg: 'HS512' } });
  11. var decoded = jwt.decode(token, {complete: true});
  12. expect(decoded.header.alg).to.equal('HS512');
  13. });
  14. });