Skip to content

Commit

Permalink
fix: remove optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
MAE776569 committed Nov 6, 2022
1 parent 8799a2a commit 68597fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async function makeRequest(method, auth, url, qs, data, cb) {

try {
const response = await request(url, options);
const data = (response.statusCode !== 204 && (response.headers["content-type"]?.startsWith("application/json"))) ? await response.body.json() : await response.body.text();
const data = (response.statusCode !== 204 && (response.headers["content-type"] && response.headers["content-type"].startsWith("application/json"))) ? await response.body.json() : await response.body.text();
return createResponseHandler(cb)(null, response, data, req);
} catch (error) {
const data = request.body;
Expand Down

0 comments on commit 68597fc

Please sign in to comment.