diff --git a/test/test.ts b/test/test.ts index 1a8484f..11a134d 100644 --- a/test/test.ts +++ b/test/test.ts @@ -52,8 +52,8 @@ tap.test('first test', async (tools) => { const response2 = await new webrequest.WebRequest().getJson('http://localhost:2345/apiroute3'); - console.log(response); - console.log(response2); + console.log('response 1: ' + JSON.stringify(response)); + console.log('response 2: ' + JSON.stringify(response2)); expect(response).property('hithere').to.equal('hi'); expect(response2).property('hithere').to.equal('hi'); diff --git a/ts/index.ts b/ts/index.ts index 0c7924a..9fa1004 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -123,9 +123,11 @@ export class WebRequest { if (response.status >= 200 && response.status < 300) { return response; } else { + // lets perform a history check to determine failed urls await doHistoryCheck(response.status.toString()); - // tslint:disable-next-line: no-return-await - return await doRequest(allUrls[usedUrlIndex]); + // lets fire the request + const result = await doRequest(allUrls[usedUrlIndex]); + return result; } };