From 0842b506964cccc2d66a9aa742847b4027b82ed9 Mon Sep 17 00:00:00 2001 From: pofider Date: Wed, 27 Mar 2024 22:23:16 +0100 Subject: [PATCH] regression fix url in the async response text --- packages/jsreport-reports/lib/main.js | 5 +++-- packages/jsreport-reports/test/reportsTest.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/jsreport-reports/lib/main.js b/packages/jsreport-reports/lib/main.js index 4404313ed..77ff862d3 100644 --- a/packages/jsreport-reports/lib/main.js +++ b/packages/jsreport-reports/lib/main.js @@ -259,8 +259,6 @@ class Reports { const clientNotification = request.context.clientNotification = this.reporter.Response(request.context.id, response) - await clientNotification.output.update(Buffer.from(`Async rendering in progress. Use Location response header to check the current status. Check it here`)) - clientNotification.meta.contentType = 'text/html' clientNotification.meta.fileExtension = 'html' @@ -270,6 +268,9 @@ class Reports { } else { clientNotification.meta.headers.Location = `${request.context.http.baseUrl}/reports/${r._id}/status` } + await clientNotification.output.update(Buffer.from(`Async rendering in progress. Use Location response header to check the current status. Check it here`)) + } else { + await clientNotification.output.update(Buffer.from('Async rendering in progress.')) } this.reporter.logger.info('Responding with async report location and continue with async report generation', request) diff --git a/packages/jsreport-reports/test/reportsTest.js b/packages/jsreport-reports/test/reportsTest.js index a812a23a7..c6acebeec 100644 --- a/packages/jsreport-reports/test/reportsTest.js +++ b/packages/jsreport-reports/test/reportsTest.js @@ -180,8 +180,8 @@ describe('with reports extension', () => { const response = await reporter.render(request) response.content.toString().should.containEql('Async rendering in progress') + response.content.toString().should.containEql('http://localhost/reports/') response.meta.headers.Location.should.be.ok() - return waitForAsyncFinishPromise })