webhook/dist/index.js

104 lines
2.8 KiB
JavaScript

module.exports =
/******/ (function(modules, runtime) { // webpackBootstrap
/******/ "use strict";
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ var threw = true;
/******/ try {
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ threw = false;
/******/ } finally {
/******/ if(threw) delete installedModules[moduleId];
/******/ }
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ __webpack_require__.ab = __dirname + "/";
/******/
/******/ // the startup function
/******/ function startup() {
/******/ // Load entry module and return exports
/******/ return __webpack_require__(52);
/******/ };
/******/
/******/ // run startup
/******/ return startup();
/******/ })
/************************************************************************/
/******/ ({
/***/ 52:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
const request = __webpack_require__(145)
console.log(process.env)
const urls = process.env.INPUT_URLS.replace('\n', ' ').trim().replace(/\s+/, ',').split(',').filter(s => s)
const content_type = process.env.INPUT_CONTENT_TYPE.trim()
const template = process.env.INPUT_TEMPLATE.trim()
urls.forEach(item => {
if (request) {
// 设置请求选项
const options = {
method: 'POST',
headers: {
'Content-Type': content_type, // 指定请求体类型为JSON格式
'Content-Length': Buffer.byteLength(template) // 计算请求体长度
}
};
// 创建HTTP客户端并发送POST请求
const req = request(item, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(`服务器返回结果:${data}`);
})
})
req.write(template) // 将POST请求参数写入请求流中
req.end() // 完成请求
}
})
/***/ }),
/***/ 145:
/***/ (function(module) {
module.exports = eval("require")("request");
/***/ })
/******/ });