From 748170326f0708e9a16b053bf47de9efb93be1ed Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 21 Apr 2020 13:24:39 +0200 Subject: [PATCH] add debug statements --- src/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 534681e..bd613bf 100644 --- a/src/index.js +++ b/src/index.js @@ -15,6 +15,8 @@ if (!!core.getInput('customHeaders')) { const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' } if (!!core.getInput('username') || !!core.getInput('password')) { + core.debug('Add BasicHTTP Auth config') + auth = { username: core.getInput('username'), password: core.getInput('password') @@ -25,19 +27,27 @@ if (!!core.getInput('bearerToken')) { headers['Authentication'] = `Bearer ${core.getInput('bearerToken')}`; } -const instance = axios.create({ +const instanceConfig = { baseURL: core.getInput('url', { required: true }), timeout: parseInt(core.getInput('timeout') || 5000, 10), headers: { ...headers, ...customHeaders } -}); +} + +core.debug(JSON.stringify(instanceConfig)) + +const instance = axios.create(instanceConfig); (async() => { try { - const response = await instance.request({ + const requestData = { auth, method: core.getInput('method') || 'POST', data: JSON.parse(core.getInput('data') || '{}') - }) + } + + core.debug(JSON.stringify(requestData)) + + const response = await instance.request(requestData) core.setOutput('response', JSON.stringify(response.data)) } catch (error) {