Skip to content

Commit

Permalink
[Enhancement] requestAPI now can take options (authorization headers,…
Browse files Browse the repository at this point in the history
… method, etc)
  • Loading branch information
naseif committed Nov 3, 2021
1 parent 354b285 commit 8a17ee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/requestAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const fetch = require("node-fetch");
* @returns Response from the API as JSON
*/

module.exports.requestAPI = async (url) => {
module.exports.requestAPI = async (url, options = {}) => {
try {
const request = await fetch(url);
const request = await fetch(url, options);
const responseToJson = await request.json();
return responseToJson;
} catch (err) {
Expand Down

0 comments on commit 8a17ee8

Please sign in to comment.