Compare commits

..

1 Commits

Author SHA1 Message Date
Frank Jogeleit
6f415ec7c5 Support File Arrays
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2023-11-30 14:07:10 +01:00
14 changed files with 3704 additions and 2509 deletions

View File

@@ -69,3 +69,116 @@ jobs:
- name: Repository Integrity Check - name: Repository Integrity Check
run: | run: |
git diff --quiet dist git diff --quiet dist
test:
if: >
!failure() &&
!cancelled()
needs:
- integrity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Request Postman Echo GET
uses: ./
with:
url: 'https://postman-echo.com/get'
method: 'GET'
- name: Request Postman Echo POST
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
data: '{ "key": "value" }'
- name: Request Postman Echo POST with Unescaped Newline
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
escapeData: 'true'
data: >-
{
"key":"multi line\ntest
text"
}
- name: Request Postman Echo BasicAuth
uses: ./
with:
url: 'https://postman-echo.com/basic-auth'
method: 'GET'
username: 'postman'
password: 'password'
- name: Request Postman Echo with 404 Response and ignore failure code
uses: ./
with:
url: 'https://postman-echo.com/status/404'
method: 'GET'
ignoreStatusCodes: '404'
- name: Create Test File
run: |
echo "test" > testfile1.txt
echo "test" > testfile2.txt
- name: Request Postman Echo POST Multipart
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
data: '{ "key": "value" }'
files: '{ "file": "${{ github.workspace }}/testfile1.txt" }'
- name: Request Postman Echo POST Multipart File Array
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
data: '{ "key": "value" }'
files: '{ "file": ["${{ github.workspace }}/testfile1.txt", "${{ github.workspace }}/testfile2.txt"] }'
- name: Request Postman Echo POST and persist response
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
file: "${{ github.workspace }}/testfile1.txt"
responseFile: "${{ github.workspace }}/response.json"
- name: Output responseFile
run: |
cat "${{ github.workspace }}/response.json"
- name: Request Postman Echo POST Multipart without data
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
files: '{ "file": "${{ github.workspace }}/testfile1.txt" }'
- name: Request Postman Echo POST single file
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
file: "${{ github.workspace }}/testfile1.txt"
- name: Request Postman Echo POST URLEncoded string data
uses: ./
with:
url: 'https://postman-echo.com/post'
contentType : 'application/x-www-form-urlencoded'
method: 'POST'
data: 'key=value'
- name: Request Postman Echo POST URLEncoded json data
uses: ./
with:
url: 'https://postman-echo.com/post'
contentType : 'application/x-www-form-urlencoded'
method: 'POST'
data: '{"key":"value"}'

View File

@@ -1,337 +0,0 @@
on:
pull_request:
push:
branches: [main]
jobs:
test-method-get-on-existing-url:
name: "IT Test - Request Postman Echo GET"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with GET and a valid URL
id: execution
uses: ./
with:
url: 'https://postman-echo.com/get'
method: 'GET'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-method-post-on-existing-url:
name: "IT Test - Request Postman Echo POST"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with POST using valid data
id: execution
uses: ./
with:
url: "https://postman-echo.com/post"
method: 'POST'
data: '{ "key": "value" }'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-method-post-on-existing-url-with-unescaped-newline:
name: "IT Test - Request Postman Echo POST with Unescaped Newline"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with POST using unescaped new line within data
id: execution
uses: ./
with:
url: "https://postman-echo.com/post"
method: 'POST'
escapeData: 'true'
data: >-
{
"key":"multi line\ntest
text"
}
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-basic-auth:
name: "IT Test - Request Postman Echo BasicAuth"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with valid BasicAuth parameters
id: execution
uses: ./
with:
url: 'https://postman-echo.com/basic-auth'
method: 'GET'
username: 'postman'
password: 'password'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200 as this URL exists
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-input-ignore-failure-code-404:
name: "IT Test - Request Postman Echo with 404 Response and ignore failure code"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with unknown URL and ignoreStatusCode 404 for it
id: execution
uses: ./
with:
url: 'https://postman-echo.com/status/404'
method: 'GET'
ignoreStatusCodes: '404'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must 404
with:
expected: '404'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then the outcome value must be success as the error 404 is ignored
with:
expected: 'success'
actual: ${{ steps.execution.outcome }}
comparison: exact
test-input-ignore-failure-multiple-codes-401-404:
name: "IT Test - Request Postman Echo with 404 Response and ignore failure code"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with unknown URL and ignore status codes 401,404
id: execution
uses: ./
with:
url: 'https://postman-echo.com/status/404'
method: 'GET'
ignoreStatusCodes: '401,404'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 404
with:
expected: '404'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then the outcome value must be success as the error 404 is ignored
with:
expected: 'success'
actual: ${{ steps.execution.outcome }}
comparison: exact
test-input-files:
name: "IT Test - Request Postman Echo POST Multipart"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create Test File
run: |
echo "test" > testfile.txt
- name: Given the gh-action is used with file and data
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
data: '{ "key": "value" }'
files: '{ "file": "${{ github.workspace }}/testfile.txt" }'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-input-responseFile:
name: "IT Test - Request Postman Echo POST and persist response"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create Test File
run: |
echo "test" > testfile2.txt
- name: Given the gh-action is used with file and responseFile
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
file: "${{ github.workspace }}/testfile2.txt"
responseFile: "${{ github.workspace }}/response.json"
- name: Output responseFile
id: execution-response-file
run: |
echo "response_content=$(cat ${{ github.workspace }}/response.json)" >> $GITHUB_OUTPUT
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.response_content value must include
with:
expected: '{"args":{},"data":"test\n","files":{},"form":{},"headers":{"host":"postman-echo.com",'
actual: ${{ steps.execution-response-file.outputs.response_content }}
comparison: contains
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.response_content value must include
with:
expected: '"accept":"application/json, text/plain, */*","content-type":"application/json","user-agent"'
actual: ${{ steps.execution-response-file.outputs.response_content }}
comparison: contains
test-input-files-without-data:
name: "IT Test - Request Postman Echo POST Multipart without data"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create Test File
run: |
echo "test" > testfile3.txt
- name: Given the gh-action is used with file
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
files: '{ "file": "${{ github.workspace }}/testfile3.txt" }'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-input-file-with-single-file:
name: "IT Test - Request Postman Echo POST single file"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create Test File
run: |
echo "test" > testfile4.txt
- name: Given the gh-action is used with file
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
method: 'POST'
file: "${{ github.workspace }}/testfile4.txt"
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-input-data-with-url-encoded-string:
name: "IT Test - Request Postman Echo POST URLEncoded string data"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with data form url encoded
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
contentType : 'application/x-www-form-urlencoded'
method: 'POST'
data: 'key=value'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-input-data-with-url-encoded-json-data:
name: "IT Test - Request Postman Echo POST URLEncoded json data"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with json data
id: execution
uses: ./
with:
url: 'https://postman-echo.com/post'
contentType : 'application/x-www-form-urlencoded'
method: 'POST'
data: '{"key":"value"}'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
test-delete-http-method:
name: "IT Test - Request Postman Echo DELETE"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Given the gh-action is used with method DELETE
id: execution
uses: ./
with:
url: 'https://postman-echo.com/delete'
contentType : 'application/json'
method: 'DELETE'
data: '{"key":"value"}'
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
name: Then outputs.status value must be 200
with:
expected: '200'
actual: ${{ steps.execution.outputs.status }}
comparison: exact
it-tests:
name: "All IT Tests have to pass"
runs-on: ubuntu-latest
if: always()
needs:
# Add your tests here so that they prevent the merge of broken changes
- test-method-get-on-existing-url
- test-method-post-on-existing-url
- test-method-post-on-existing-url-with-unescaped-newline
- test-basic-auth
- test-input-ignore-failure-code-404
- test-input-ignore-failure-multiple-codes-401-404
- test-input-files
- test-input-responseFile
- test-input-files-without-data
- test-input-file-with-single-file
- test-input-data-with-url-encoded-string
- test-input-data-with-url-encoded-json-data
- test-delete-http-method
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}

View File

@@ -45,10 +45,8 @@ jobs:
|httpsCert| Client Certificate as string || |httpsCert| Client Certificate as string ||
|httpsKey| Client Certificate Key as string || |httpsKey| Client Certificate Key as string ||
|responseFile| Persist the response data to the specified file path || |responseFile| Persist the response data to the specified file path ||
|maskResponse| If set to true, the response will be masked in the logs of the action |'false'|
|retry| optional amount of retries if the request is failing, does not retry if the status code is ignored || |retry| optional amount of retries if the request is failing, does not retry if the status code is ignored ||
|retryWait| time between each retry in millseconds | 3000 | |retryWait| time between each retry in millseconds | 3000 |
|ignoreSsl| ignore ssl verify (rejectUnauthorized: false) | false |
### Response ### Response
@@ -56,7 +54,6 @@ jobs:
|---|---| |---|---|
`response` | Response as JSON String `response` | Response as JSON String
`headers` | Headers `headers` | Headers
`status` | HTTP status message
To display HTTP response data in the GitHub Actions log give the request an `id` and access its `outputs`. You can also access specific field from the response data using [fromJson()](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson) expression. To display HTTP response data in the GitHub Actions log give the request an `id` and access its `outputs`. You can also access specific field from the response data using [fromJson()](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson) expression.
@@ -71,7 +68,6 @@ steps:
run: | run: |
echo ${{ steps.myRequest.outputs.response }} echo ${{ steps.myRequest.outputs.response }}
echo ${{ steps.myRequest.outputs.headers }} echo ${{ steps.myRequest.outputs.headers }}
echo ${{ steps.myRequest.outputs.status }}
echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }} echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }}
``` ```

View File

@@ -29,7 +29,7 @@ inputs:
description: 'Auth Password' description: 'Auth Password'
required: false required: false
timeout: timeout:
description: 'Request Timeout in milliseconds' description: 'Request Timeout in Sec'
required: false required: false
default: '5000' default: '5000'
bearerToken: bearerToken:
@@ -59,26 +59,17 @@ inputs:
responseFile: responseFile:
description: 'Persist the response data to the specified file path' description: 'Persist the response data to the specified file path'
required: false required: false
maskResponse:
description: 'Allows to mark your response as secret and hide the output in the action logs'
required: false
default: 'false'
retry: retry:
description: 'optional amount of retries if the request fails' description: 'optional amount of retries if the request fails'
required: false required: false
retryWait: retryWait:
description: 'wait time between retries in milliseconds' description: 'wait time between retries in milliseconds'
required: false required: false
ignoreSsl:
description: 'ignore ssl verify (rejectUnauthorized: false)'
default: 'false'
outputs: outputs:
response: response:
description: 'HTTP Response Content' description: 'HTTP Response Content'
headers: headers:
description: 'HTTP Response Headers' description: 'HTTP Response Headers'
status:
description: 'HTTP status message'
runs: runs:
using: 'node20' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

2771
dist/index.js vendored

File diff suppressed because it is too large Load Diff

2837
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,12 +20,14 @@
"homepage": "https://github.com/fjogeleit/http-request-action#readme", "homepage": "https://github.com/fjogeleit/http-request-action#readme",
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"axios": "^1.7", "axios": "^1.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"yargs": "^17.7.2" "yargs": "^17.7.2"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1" "@actions/core": "^1.10.1",
"install": "^0.13.0",
"npm": "^10.2.4"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"

View File

@@ -19,10 +19,6 @@ class GithubActions {
core.setOutput(name, output) core.setOutput(name, output)
} }
setSecret(value) {
core.setSecret(value)
}
setFailed(message) { setFailed(message) {
core.setFailed(message) core.setFailed(message)
} }

View File

@@ -1,15 +0,0 @@
'use strict'
const axios = require('axios');
const { GithubActions } = require('../githubActions');
/**
* @param {GithubActions} actions
*
* @returns {(response: axios.AxiosResponse) => void}
*/
const createMaskHandler = (actions) => (response) => {
actions.setSecret(JSON.stringify(response.data))
}
module.exports = { createMaskHandler }

View File

@@ -1,17 +0,0 @@
'use strict'
const axios = require('axios');
const { GithubActions } = require('../githubActions');
/**
* @param {GithubActions} actions
*
* @returns {(response: axios.AxiosResponse) => void}
*/
const createOutputHandler = (actions) => (response) => {
actions.setOutput('response', JSON.stringify(response.data))
actions.setOutput('headers', response.headers)
actions.setOutput('status', response.status)
}
module.exports = { createOutputHandler }

View File

@@ -17,8 +17,8 @@ const createPersistHandler = (filePath, actions) => (response) => {
data = JSON.stringify(data) data = JSON.stringify(data)
} }
fs.writeFile(filePath, data, error => { fs.writeFile(filePath, data, err => {
if (!error) { if (!err) {
actions.info(`response persisted successfully at ${filePath}`) actions.info(`response persisted successfully at ${filePath}`)
return return
} }

View File

@@ -24,7 +24,7 @@ const convertToJSON = (value) => {
* *
* @returns {FormData} * @returns {FormData}
*/ */
const convertToFormData = (data, files, convertPaths) => { const convertToFormData = async (data, files, convertPaths) => {
const formData = new FormData(); const formData = new FormData();
for (const [key, value] of Object.entries(data)) { for (const [key, value] of Object.entries(data)) {
@@ -32,8 +32,12 @@ const convertToFormData = (data, files, convertPaths) => {
} }
for (const [key, value] of Object.entries(files)) { for (const [key, value] of Object.entries(files)) {
if (Array.isArray(value)) {
value.forEach(v => formData.append(key, fs.createReadStream(v)))
} else {
formData.append(key, fs.createReadStream(value)); formData.append(key, fs.createReadStream(value));
} }
}
return formData; return formData;
}; };
@@ -55,8 +59,8 @@ const retry = async (callback, options) => {
lastErr = err; lastErr = err;
} }
if (i < options.retry) { if (i < options.retries) {
options.actions.warning(`#${i + 1} request failed: ${lastErr}`); options.actions.warning(`#${i + 1} request failed: ${err}`);
await sleep(options.sleep); await sleep(options.sleep);
} }

View File

@@ -95,7 +95,7 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
if (error.response && options.ignoredCodes.includes(error.response.status)) { if (error.response && options.ignoredCodes.includes(error.response.status)) {
actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`) actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`)
return error.response return null
} }
if (!error.response && error.request && options.preventFailureOnNoResponse) { if (!error.response && error.request && options.preventFailureOnNoResponse) {
@@ -119,6 +119,9 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
return null return null
} }
actions.setOutput('response', JSON.stringify(response.data))
actions.setOutput('headers', response.headers)
return response return response
} catch (error) { } catch (error) {
if ((typeof error === 'object') && (error.isAxiosError === true)) { if ((typeof error === 'object') && (error.isAxiosError === true)) {
@@ -194,9 +197,9 @@ const updateConfigForFile = (instanceConfig, filePath, actions) => {
* @returns {Promise<number>} * @returns {Promise<number>}
*/ */
const contentLength = (formData) => new Promise((resolve, reject) => { const contentLength = (formData) => new Promise((resolve, reject) => {
formData.getLength((error, length) => { formData.getLength((err, length) => {
if (error) { if (err) {
reject(error) reject (err)
return return
} }

View File

@@ -5,10 +5,7 @@ const axios = require('axios');
const https = require('https'); const https = require('https');
const { request, METHOD_POST } = require('./httpClient'); const { request, METHOD_POST } = require('./httpClient');
const { GithubActions } = require('./githubActions'); const { GithubActions } = require('./githubActions');
const { createPersistHandler } = require('./handler/persist'); const { createPersistHandler } = require('./handler/persist');
const { createOutputHandler } = require('./handler/output');
const { createMaskHandler } = require('./handler/mask');
let customHeaders = {} let customHeaders = {}
@@ -29,9 +26,6 @@ if (!!core.getInput('bearerToken')) {
/** @type {axios.AxiosRequestConfig} */ /** @type {axios.AxiosRequestConfig} */
const instanceConfig = { const instanceConfig = {
httpsAgent: new https.Agent({
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
}),
baseURL: core.getInput('url', { required: true }), baseURL: core.getInput('url', { required: true }),
timeout: parseInt(core.getInput('timeout') || 5000, 10), timeout: parseInt(core.getInput('timeout') || 5000, 10),
headers: { ...headers, ...customHeaders } headers: { ...headers, ...customHeaders }
@@ -61,7 +55,7 @@ if (!!core.getInput('retry')) {
let retryWait = 3000 let retryWait = 3000
if (!!core.getInput('retryWait')) { if (!!core.getInput('retryWait')) {
retryWait = parseInt(core.getInput('retryWait')) retry = parseInt(core.getInput('retryWait'))
} }
const data = core.getInput('data') || '{}'; const data = core.getInput('data') || '{}';
@@ -79,15 +73,8 @@ if (typeof ignoreStatusCodes === 'string' && ignoreStatusCodes.length > 0) {
ignoredCodes = ignoreStatusCodes.split(',').map(statusCode => parseInt(statusCode.trim())) ignoredCodes = ignoreStatusCodes.split(',').map(statusCode => parseInt(statusCode.trim()))
} }
const actions = new GithubActions();
const handler = []; const handler = [];
const actions = new GithubActions();
if (core.getBooleanInput('maskResponse')) {
handler.push(createMaskHandler(actions))
}
handler.push(createOutputHandler(actions))
if (!!responseFile) { if (!!responseFile) {
handler.push(createPersistHandler(responseFile, actions)) handler.push(createPersistHandler(responseFile, actions))
@@ -102,7 +89,7 @@ const options = {
} }
request({ data, method, instanceConfig, files, file, actions, options }).then(response => { request({ data, method, instanceConfig, files, file, actions, options }).then(response => {
if (response && typeof response == 'object') { if (typeof response == 'object') {
handler.forEach(h => h(response)) handler.forEach(h => h(response))
} }
}) })