mirror of
https://github.com/joelwmale/webhook-action.git
synced 2026-09-02 18:56:15 +08:00
Allow optional headers & body
This commit is contained in:
Vendored
+6
-4
@@ -312,10 +312,12 @@ var Http = (function () {
|
||||
};
|
||||
Http.prototype.getOptions = function (method, headers, body) {
|
||||
var options = {
|
||||
headers: JSON.parse(headers),
|
||||
headers: headers ? JSON.parse(headers) : {},
|
||||
method: method
|
||||
};
|
||||
options.body = JSON.stringify(body);
|
||||
if (body) {
|
||||
options.body = body;
|
||||
}
|
||||
options.headers['content-type'] = 'application/json';
|
||||
return options;
|
||||
};
|
||||
@@ -2132,8 +2134,8 @@ function run() {
|
||||
var url, headers, body;
|
||||
return __generator(this, function (_c) {
|
||||
url = core.getInput('url');
|
||||
headers = (_a = core.getInput('headers')) !== null && _a !== void 0 ? _a : '';
|
||||
body = (_b = core.getInput('body')) !== null && _b !== void 0 ? _b : '';
|
||||
headers = (_a = core.getInput('headers')) !== null && _a !== void 0 ? _a : null;
|
||||
body = (_b = core.getInput('body')) !== null && _b !== void 0 ? _b : null;
|
||||
core.info("Sending webhook request to " + url);
|
||||
core.debug((new Date()).toTimeString());
|
||||
http_1.http.make(url, headers, body)
|
||||
|
||||
Reference in New Issue
Block a user