Browse Source

send empty bodies instead of undefined

pull/4/head
f0x 5 years ago
parent
commit
3551137dc6
  1. 4
      src/oauth.js

4
src/oauth.js

@ -142,9 +142,11 @@ module.exports = function oauthClient(config, initState) {
"Authorization": `Bearer ${state.access_token}`
};
let body = data;
if (type == "json") {
if (type == "json" && body != undefined) {
headers["Content-Type"] = "application/json";
body = JSON.stringify(data);
} else if (body == undefined) {
body = "";
}
return fetch(url.href, {
method,

Loading…
Cancel
Save