diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e252825..522037b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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' diff --git a/dist/index.js b/dist/index.js index 00e16ba..62e44c1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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)) diff --git a/src/index.js b/src/index.js index bd613bf..8d230d2 100644 --- a/src/index.js +++ b/src/index.js @@ -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))