mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2025-12-31 15:02:19 +00:00
fix: #45 Add HTTP proxy support
Signed-off-by: Devin <hoopysoup@users.noreply.github.com>
This commit is contained in:
parent
9cc1438d52
commit
2bc068a74a
1 changed files with 11 additions and 6 deletions
|
|
@ -28,21 +28,26 @@ class Release {
|
|||
* @return {Array<Release>} Releases.
|
||||
*/
|
||||
async function fetchReleases (githubToken) {
|
||||
const hc = require('@actions/http-client');
|
||||
const userAgent = 'opentofu/setup-opentofu';
|
||||
|
||||
const http = new hc.HttpClient(userAgent);
|
||||
|
||||
const url = 'https://get.opentofu.org/tofu/api.json';
|
||||
|
||||
const headers = {
|
||||
Accept: 'application/json'
|
||||
};
|
||||
|
||||
const resp = await fetch(url, {
|
||||
headers
|
||||
});
|
||||
const resp = await http.get(url, headers);
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error('failed fetching releases (' + resp.status + ')');
|
||||
if (resp.message.statusCode !== 200) {
|
||||
throw new Error('failed fetching releases (' + resp.message.statusCode + ')');
|
||||
}
|
||||
|
||||
const releasesMeta = await resp.json();
|
||||
body = await resp.readBody();
|
||||
const releasesMeta = JSON.parse(body);
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue