UNPKG

@vulcan-sql/extension-huggingface

Version:

Hugging Face feature for VulcanSQL

24 lines 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.postRequest = void 0; const tslib_1 = require("tslib"); const axios_1 = require("axios"); const postRequest = (url, data, token) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { var _a; try { const result = yield axios_1.default.post(url, data, { headers: { Authorization: `Bearer ${token}` }, }); return result.data; } catch (error) { const axiosError = error; // https://axios-http.com/docs/handling_errors // if response has error, throw the response error, or throw the request error if (axiosError.response) throw new Error(JSON.stringify((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.data)); throw new Error(axiosError.message); } }); exports.postRequest = postRequest; //# sourceMappingURL=request.js.map