From 255ebfefcbcbf793ae732464358f9653bf2c7010 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 15 Feb 2019 10:07:15 -0400 Subject: [PATCH] Allow jwt to take null or undefined Minor change, but I've had to do this in my code which I'm not a big fan of: `api.jwt(getToken().accessToken || null)` --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 5e55899..d99ffcc 100644 --- a/src/index.js +++ b/src/index.js @@ -284,7 +284,7 @@ class Frisbee { } jwt(token) { - if (token === null) delete this.headers.Authorization; + if (token === null || token === undefined) delete this.headers.Authorization; else if (typeof token === 'string') this.headers.Authorization = `Bearer ${token}`; else throw new TypeError('jwt token must be a string');