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: with:
ref: ${{ github.ref }} ref: ${{ github.ref }}
- name: Request Google Test - name: Request Postment Echo GET
uses: ./ uses: ./
with: with:
url: 'https://google.de' url: 'https://postman-echo.com/get'
method: '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 core = __webpack_require__(470);
const axios = __webpack_require__(53); const axios = __webpack_require__(53);
const METHOD_GET = 'GET'
const METHOD_POST = 'POST'
let auth = undefined let auth = undefined
let customHeaders = {} let customHeaders = {}
@ -2635,10 +2638,13 @@ const instance = axios.create(instanceConfig);
(async() => { (async() => {
try { try {
const method = core.getInput('method') || METHOD_POST;
const data = method === METHOD_GET ? undefined : JSON.parse(core.getInput('data') || '{}')
const requestData = { const requestData = {
auth, auth,
method: core.getInput('method') || 'POST', method,
data: JSON.parse(core.getInput('data') || '{}') data
} }
core.debug(JSON.stringify(requestData)) core.debug(JSON.stringify(requestData))

View file

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