Skip to content
Permalink
Browse files

[DDW-677] Fix network handling logic for app-version checks

  • Loading branch information...
nikolaglumac committed Jun 12, 2019
1 parent 3f87c69 commit 657019b89a219a4f07b6ecd8d04771358aec0f69
@@ -3,8 +3,8 @@ import type { DaedalusLatestVersionResponse } from '../types';
import { externalRequest } from '../../utils/externalRequest';
import { getLatestVersionInfoUrl } from '../../../utils/network';

const { isStaging, isTestnet, NETWORK } = global.environment;
const hostname = getLatestVersionInfoUrl(NETWORK);
const { isStaging, isTestnet, network } = global.environment;
const hostname = getLatestVersionInfoUrl(network);
const path = isStaging || isTestnet ? '' : '/update.cardano-mainnet.iohk.io';

export const getLatestAppVersion = (): Promise<DaedalusLatestVersionResponse> => (
@@ -24,7 +24,7 @@ export const externalRequest = (httpOptions: HttpOptions): Promise<any> => (
const options = omit(httpOptions, 'protocol');
const requestMethod = global[protocol].request;
const request = requestMethod(options);
console.debug('[externalRequest::start]', options, request);

request.on('response', response => {
let body = '';
response.on('data', chunk => {
@@ -33,7 +33,6 @@ export const externalRequest = (httpOptions: HttpOptions): Promise<any> => (
response.on('error', error => reject(error));
response.on('end', () => {
try {
console.debug('[externalRequest::end]', body);
const parsedBody = JSON.parse(body);
resolve(parsedBody);
} catch (error) {

0 comments on commit 657019b

Please sign in to comment.
You can’t perform that action at this time.