mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-09-04 21:46:59 +08:00
v2.1.0
This commit is contained in:
Vendored
+7
-4
@@ -2,17 +2,17 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.http = void 0;
|
||||
var fetch = require('node-fetch');
|
||||
var https = require('https');
|
||||
var Http = (function () {
|
||||
function Http() {
|
||||
}
|
||||
Http.prototype.make = function (url, headers, body) {
|
||||
Http.prototype.make = function (url, headers, body, ignoreCertificate) {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
fetch(url, _this.getOptions('post', headers, body))
|
||||
.then(function (res) { return resolve(res); });
|
||||
fetch(url, _this.getOptions('post', headers, body, ignoreCertificate)).then(function (res) { return resolve(res); });
|
||||
});
|
||||
};
|
||||
Http.prototype.getOptions = function (method, headers, body) {
|
||||
Http.prototype.getOptions = function (method, headers, body, ignoreCertificate) {
|
||||
var options = {
|
||||
headers: headers ? JSON.parse(headers) : {},
|
||||
method: method
|
||||
@@ -20,6 +20,9 @@ var Http = (function () {
|
||||
if (body) {
|
||||
options.body = body;
|
||||
}
|
||||
if (ignoreCertificate) {
|
||||
options.agent = new https.Agent({ rejectUnauthorized: false });
|
||||
}
|
||||
options.headers['content-type'] = 'application/json';
|
||||
return options;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user