From 2f05010648a22e7da5d33b8299627d716103fe77 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 3 Jul 2021 21:39:30 +0200 Subject: [PATCH] Fix tests --- scripts/ScriptUtils.ts | 12 ++++++++++-- test/OsmObject.spec.ts | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/ScriptUtils.ts b/scripts/ScriptUtils.ts index 54b340a7c..ccf230275 100644 --- a/scripts/ScriptUtils.ts +++ b/scripts/ScriptUtils.ts @@ -1,5 +1,6 @@ import {lstatSync, readdirSync, readFileSync} from "fs"; import {Utils} from "../Utils"; + Utils.runningFromConsole = true import * as https from "https"; import {LayerConfigJson} from "../Customizations/JSON/LayerConfigJson"; @@ -52,8 +53,15 @@ export default class ScriptUtils { return new Promise((resolve, reject) => { try { - - https.get(url, (res) => { + const urlObj = new URL(url) + https.get({ + host: urlObj.host, + path: urlObj.pathname, + port: urlObj.port, + headers: { + "accept": "application/json" + } + }, (res) => { const parts: string[] = [] res.setEncoding('utf8'); res.on('data', function (chunk) { diff --git a/test/OsmObject.spec.ts b/test/OsmObject.spec.ts index f5145a41e..075d262bb 100644 --- a/test/OsmObject.spec.ts +++ b/test/OsmObject.spec.ts @@ -9,7 +9,7 @@ export default class OsmObjectSpec extends T { "Download referencing ways", () => { let downloaded = false; - OsmObject.DownloadReferencingWays("node/1124134958", ways => { + OsmObject.DownloadReferencingWays("node/1124134958").addCallbackAndRunD(ways => { downloaded = true; console.log(ways) })