mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
Allow optional headers & body
This commit is contained in:
parent
5be5ae3f9a
commit
d3ff660fa9
6
dist/http.js
vendored
6
dist/http.js
vendored
@ -14,10 +14,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;
|
||||
};
|
||||
|
2
dist/http.js.map
vendored
2
dist/http.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;AAAA,IAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEpC;IAAA;IAsBA,CAAC;IArBC,mBAAI,GAAJ,UAAK,GAAW,EAAE,OAAe,EAAE,IAAY;QAA/C,iBAKC;QAJC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,KAAK,CAAC,GAAG,EAAE,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;iBAC/C,IAAI,CAAC,UAAC,GAAa,IAAK,OAAA,OAAO,CAAC,GAAG,CAAC,EAAZ,CAAY,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yBAAU,GAAV,UAAW,MAAc,EAAE,OAAe,EAAE,IAAY;QACtD,IAAM,OAAO,GAAQ;YACnB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,MAAM,QAAA;SACP,CAAC;QAGF,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAGpC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAErD,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,WAAC;AAAD,CAAC,AAtBD,IAsBC;AAEY,QAAA,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC"}
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;AAAA,IAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEpC;IAAA;IAwBA,CAAC;IAvBC,mBAAI,GAAJ,UAAK,GAAW,EAAE,OAAe,EAAE,IAAY;QAA/C,iBAKC;QAJC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,KAAK,CAAC,GAAG,EAAE,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;iBAC/C,IAAI,CAAC,UAAC,GAAa,IAAK,OAAA,OAAO,CAAC,GAAG,CAAC,EAAZ,CAAY,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yBAAU,GAAV,UAAW,MAAc,EAAE,OAAe,EAAE,IAAY;QACtD,IAAM,OAAO,GAAQ;YACnB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YAC3C,MAAM,QAAA;SACP,CAAC;QAEF,IAAI,IAAI,EAAE;YAER,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;SACrB;QAGD,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAErD,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,WAAC;AAAD,CAAC,AAxBD,IAwBC;AAEY,QAAA,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC"}
|
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -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)
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/main.js
vendored
4
dist/main.js
vendored
@ -44,8 +44,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)
|
||||
|
2
dist/main.js.map
vendored
2
dist/main.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsC;AACtC,+BAA8B;AAE9B,SAAe,GAAG;;;;;YACR,GAAG,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;YAG3C,IAAI,CAAC,IAAI,CAAC,gCAA8B,GAAK,CAAC,CAAC;YAG/C,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;YAGxC,WAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC;iBAC1B,IAAI,CAAC,UAAC,GAAG;gBAER,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEzC,IAAI,CAAC,IAAI,CAAC,2BAAyB,GAAG,CAAC,MAAQ,CAAC,CAAC;gBAEjD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;YACzC,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,GAAG;gBAET,IAAI,CAAC,SAAS,CAAC,2BAAyB,GAAG,CAAC,MAAQ,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;;;;CACR;AAED,GAAG,EAAE,CAAC"}
|
BIN
node_modules/@vercel/ncc/dist/ncc/cli.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/cli.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/index.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/index.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js.cache
generated
vendored
Binary file not shown.
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js.cache
generated
vendored
BIN
node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js.cache
generated
vendored
Binary file not shown.
@ -10,12 +10,14 @@ class Http {
|
||||
|
||||
getOptions(method: string, headers: string, body: string) {
|
||||
const options: any = {
|
||||
headers: JSON.parse(headers),
|
||||
headers: headers ? JSON.parse(headers) : {},
|
||||
method
|
||||
};
|
||||
|
||||
// stringify the body
|
||||
options.body = JSON.stringify(body);
|
||||
if (body) {
|
||||
// parse the body
|
||||
options.body = body;
|
||||
}
|
||||
|
||||
// set these headers
|
||||
options.headers['content-type'] = 'application/json';
|
||||
|
@ -3,8 +3,8 @@ import { http } from './http';
|
||||
|
||||
async function run() {
|
||||
const url = core.getInput('url');
|
||||
const headers = core.getInput('headers') ?? '';
|
||||
const body = core.getInput('body') ?? '';
|
||||
const headers = core.getInput('headers') ?? null;
|
||||
const body = core.getInput('body') ?? null;
|
||||
|
||||
// initial info
|
||||
core.info(`Sending webhook request to ${url}`);
|
||||
|
Loading…
Reference in New Issue
Block a user