quria
Version:
A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.
16 lines (15 loc) • 688 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.httpRequest = void 0;
const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
async function httpRequest(url, json = false, method = "GET", headers, body) {
let options = { method, headers };
if (method === "POST")
options.body = body;
let bungieRequest = await (0, isomorphic_unfetch_1.default)(url, options);
return json ? await bungieRequest.json() : await bungieRequest.text();
}
exports.httpRequest = httpRequest;