mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-11-25 13:20:56 -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:
|
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
10
dist/index.js
vendored
|
@ -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))
|
||||||
|
|
10
src/index.js
10
src/index.js
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue