mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-12-23 04:37:28 +00:00
remove auth config when no http basic is defined
This commit is contained in:
parent
88637cb5c4
commit
8f0ce9cdaf
1 changed files with 6 additions and 8 deletions
14
src/index.js
14
src/index.js
|
@ -1,7 +1,7 @@
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
|
||||||
const auth = {}
|
let auth = undefined
|
||||||
let customHeaders = {}
|
let customHeaders = {}
|
||||||
|
|
||||||
if (!!core.getInput('customHeaders')) {
|
if (!!core.getInput('customHeaders')) {
|
||||||
|
@ -14,12 +14,11 @@ if (!!core.getInput('customHeaders')) {
|
||||||
|
|
||||||
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
|
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
|
||||||
|
|
||||||
if (!!core.getInput('username')) {
|
if (!!core.getInput('username') || !!core.getInput('password')) {
|
||||||
auth.username = core.getInput('username');
|
auth = {
|
||||||
}
|
username: core.getInput('username'),
|
||||||
|
password: core.getInput('password')
|
||||||
if (!!core.getInput('password')) {
|
}
|
||||||
auth.password = core.getInput('password');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!core.getInput('bearerToken')) {
|
if (!!core.getInput('bearerToken')) {
|
||||||
|
@ -32,7 +31,6 @@ const instance = axios.create({
|
||||||
headers: { ...headers, ...customHeaders }
|
headers: { ...headers, ...customHeaders }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
(async() => {
|
(async() => {
|
||||||
try {
|
try {
|
||||||
const response = await instance.request({
|
const response = await instance.request({
|
||||||
|
|
Loading…
Reference in a new issue