mirror of
https://github.com/actions/setup-java
synced 2024-11-27 11:32:03 +00:00
HTTP errors when the token is undefined (#556)
* Fixing issues with the handling of the token and avoiding error on when the token is undefined * chore: rebuild action --------- Co-authored-by: Ivan Zosimov <ivanzosimov@github.com>
This commit is contained in:
parent
a2374547df
commit
16ef37f8dd
3 changed files with 11 additions and 3 deletions
4
dist/cleanup/index.js
vendored
4
dist/cleanup/index.js
vendored
|
@ -87931,9 +87931,11 @@ function getGitHubHttpHeaders() {
|
|||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const headers = {
|
||||
authorization: auth,
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
if (auth) {
|
||||
headers.authorization = auth;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;
|
||||
|
|
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
|
@ -125282,9 +125282,11 @@ function getGitHubHttpHeaders() {
|
|||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const headers = {
|
||||
authorization: auth,
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
if (auth) {
|
||||
headers.authorization = auth;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;
|
||||
|
|
|
@ -166,9 +166,13 @@ export function convertVersionToSemver(version: number[] | string) {
|
|||
export function getGitHubHttpHeaders(): OutgoingHttpHeaders {
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
|
||||
const headers: OutgoingHttpHeaders = {
|
||||
authorization: auth,
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
|
||||
if (auth) {
|
||||
headers.authorization = auth;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue