mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-09-04 02:26:58 +08:00
chore: project cleanup
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.http = void 0;
|
||||
const node_fetch_1 = require("node-fetch");
|
||||
const https = require("https");
|
||||
class Http {
|
||||
make(url, body, headers = null, ignoreCertificate = false) {
|
||||
return new Promise(resolve => {
|
||||
(0, node_fetch_1.default)(url, this.getOptions('post', headers, body, ignoreCertificate)).then((res) => resolve(res));
|
||||
});
|
||||
}
|
||||
getOptions(method, headers, body, ignoreCertificate) {
|
||||
const options = {
|
||||
headers: headers ? JSON.parse(headers) : {},
|
||||
method
|
||||
};
|
||||
if (body) {
|
||||
options.body = body;
|
||||
}
|
||||
if (ignoreCertificate) {
|
||||
options.agent = new https.Agent({ rejectUnauthorized: false });
|
||||
}
|
||||
options.headers['content-type'] = 'application/json';
|
||||
return options;
|
||||
}
|
||||
}
|
||||
exports.http = new Http();
|
||||
//# sourceMappingURL=http.js.map
|
||||
Reference in New Issue
Block a user