167 lines
5.3 KiB
JavaScript
167 lines
5.3 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);
|
|
/******/ };
|
|
/******/ // initialize runtime
|
|
/******/ runtime(__webpack_require__);
|
|
/******/
|
|
/******/ // run startup
|
|
/******/ return startup();
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ({
|
|
|
|
/***/ 52:
|
|
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony import */ var http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(605);
|
|
/* harmony import */ var http__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(http__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(211);
|
|
/* harmony import */ var https__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(https__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
|
|
|
|
|
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 => {
|
|
console.log(item)
|
|
let request = undefined
|
|
if (item.startsWith('http://')) {
|
|
console.log('使用http', item)
|
|
request = http__WEBPACK_IMPORTED_MODULE_0__.http_request
|
|
} else if (item.startsWith('https://')) {
|
|
console.log('使用https', item)
|
|
request = https__WEBPACK_IMPORTED_MODULE_1__.https_request
|
|
}
|
|
|
|
if (request) {
|
|
// 设置请求选项
|
|
const options = {
|
|
method: 'POST', // HTTP请求方法
|
|
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() // 完成请求
|
|
}
|
|
})
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 211:
|
|
/***/ (function(module) {
|
|
|
|
module.exports = require("https");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 605:
|
|
/***/ (function(module) {
|
|
|
|
module.exports = require("http");
|
|
|
|
/***/ })
|
|
|
|
/******/ },
|
|
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
/******/ "use strict";
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ !function() {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ }();
|
|
/******/
|
|
/******/ /* webpack/runtime/compat get default export */
|
|
/******/ !function() {
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = function(module) {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ function getDefault() { return module['default']; } :
|
|
/******/ function getModuleExports() { return module; };
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/ }();
|
|
/******/
|
|
/******/ /* webpack/runtime/define property getter */
|
|
/******/ !function() {
|
|
/******/ // define getter function for harmony exports
|
|
/******/ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
/******/ if(!hasOwnProperty.call(exports, name)) {
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
/******/ }
|
|
/******/ };
|
|
/******/ }();
|
|
/******/
|
|
/******/ }
|
|
); |