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
})