mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-28 05:36:34 +00:00
Stop using request, replace it with already used axios
Changelog-entry: Stop using request, replace it with already used axios Change-type: patch
This commit is contained in:
parent
e72049d6e8
commit
dc9351713c
@ -14,17 +14,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
import * as Bluebird from 'bluebird';
|
import * as Bluebird from 'bluebird';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as request from 'request';
|
|
||||||
import * as tmp from 'tmp';
|
import * as tmp from 'tmp';
|
||||||
import { promisify } from 'util';
|
|
||||||
|
|
||||||
import * as errors from './errors';
|
import * as errors from './errors';
|
||||||
import * as settings from '../gui/app/models/settings';
|
import * as settings from '../gui/app/models/settings';
|
||||||
|
|
||||||
const getAsync = promisify(request.get);
|
|
||||||
|
|
||||||
export function isValidPercentage(percentage: any): boolean {
|
export function isValidPercentage(percentage: any): boolean {
|
||||||
return _.every([_.isNumber(percentage), percentage >= 0, percentage <= 100]);
|
return _.every([_.isNumber(percentage), percentage >= 0, percentage <= 100]);
|
||||||
}
|
}
|
||||||
@ -55,7 +52,8 @@ export async function getConfig(): Promise<_.Dictionary<any>> {
|
|||||||
const configUrl =
|
const configUrl =
|
||||||
(await settings.get('configUrl')) ||
|
(await settings.get('configUrl')) ||
|
||||||
'https://balena.io/etcher/static/config.json';
|
'https://balena.io/etcher/static/config.json';
|
||||||
return (await getAsync({ url: configUrl, json: true })).body;
|
const response = await axios.get(configUrl, { responseType: 'json' });
|
||||||
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,6 @@
|
|||||||
"react-dom": "^16.8.5",
|
"react-dom": "^16.8.5",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"rendition": "^16.1.1",
|
"rendition": "^16.1.1",
|
||||||
"request": "^2.81.0",
|
|
||||||
"resin-corvus": "^2.0.5",
|
"resin-corvus": "^2.0.5",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
"simple-progress-webpack-plugin": "^1.1.2",
|
"simple-progress-webpack-plugin": "^1.1.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user