1
0
Fork 0
mirror of https://github.com/fjogeleit/http-request-action.git synced 2024-12-22 20:32:33 +00:00

update data payload

This commit is contained in:
Frank 2020-04-21 13:55:30 +02:00
parent 3b9f5efa1c
commit 193a7dd98c
3 changed files with 18 additions and 6 deletions

View file

@ -10,8 +10,8 @@ jobs:
with:
ref: ${{ github.ref }}
- name: Request Google Test
- name: Request Postment Echo GET
uses: ./
with:
url: 'https://google.de'
url: 'https://postman-echo.com/get'
method: 'GET'

10
dist/index.js vendored
View file

@ -2597,6 +2597,9 @@ module.exports = function httpAdapter(config) {
const core = __webpack_require__(470);
const axios = __webpack_require__(53);
const METHOD_GET = 'GET'
const METHOD_POST = 'POST'
let auth = undefined
let customHeaders = {}
@ -2635,10 +2638,13 @@ const instance = axios.create(instanceConfig);
(async() => {
try {
const method = core.getInput('method') || METHOD_POST;
const data = method === METHOD_GET ? undefined : JSON.parse(core.getInput('data') || '{}')
const requestData = {
auth,
method: core.getInput('method') || 'POST',
data: JSON.parse(core.getInput('data') || '{}')
method,
data
}
core.debug(JSON.stringify(requestData))

View file

@ -1,6 +1,9 @@
const core = require("@actions/core");
const axios = require("axios");
const METHOD_GET = 'GET'
const METHOD_POST = 'POST'
let auth = undefined
let customHeaders = {}
@ -39,10 +42,13 @@ const instance = axios.create(instanceConfig);
(async() => {
try {
const method = core.getInput('method') || METHOD_POST;
const data = method === METHOD_GET ? undefined : JSON.parse(core.getInput('data') || '{}')
const requestData = {
auth,
method: core.getInput('method') || 'POST',
data: JSON.parse(core.getInput('data') || '{}')
method,
data
}
core.debug(JSON.stringify(requestData))