1
0
Fork 0
mirror of https://github.com/fjogeleit/http-request-action.git synced 2024-12-22 20:32:33 +00:00

Merge pull request #3 from fjogeleit/DirectApiRequestHasMoreThanOneAuthorization

remove auth config when no http basic is defined
This commit is contained in:
Frank Jogeleit 2020-04-21 12:44:00 +02:00 committed by GitHub
commit b52a6b1b8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
const core = require("@actions/core");
const axios = require("axios");
const auth = {}
let auth = undefined
let customHeaders = {}
if (!!core.getInput('customHeaders')) {
@ -14,12 +14,11 @@ if (!!core.getInput('customHeaders')) {
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
if (!!core.getInput('username')) {
auth.username = core.getInput('username');
}
if (!!core.getInput('password')) {
auth.password = core.getInput('password');
if (!!core.getInput('username') || !!core.getInput('password')) {
auth = {
username: core.getInput('username'),
password: core.getInput('password')
}
}
if (!!core.getInput('bearerToken')) {
@ -32,7 +31,6 @@ const instance = axios.create({
headers: { ...headers, ...customHeaders }
});
(async() => {
try {
const response = await instance.request({