mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-11-22 03:41:00 -05:00
update data payload
This commit is contained in:
parent
3b9f5efa1c
commit
193a7dd98c
3 changed files with 18 additions and 6 deletions
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -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
10
dist/index.js
vendored
|
@ -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))
|
||||
|
|
10
src/index.js
10
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))
|
||||
|
|
Loading…
Reference in a new issue