Skip to content

Commit

Permalink
regression fix url in the async response text
Browse files Browse the repository at this point in the history
  • Loading branch information
pofider committed Mar 27, 2024
1 parent 4c2306a commit 0842b50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/jsreport-reports/lib/main.js
Expand Up @@ -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 <a href='${response.meta.headers.Location}'>here</a>`))

clientNotification.meta.contentType = 'text/html'
clientNotification.meta.fileExtension = 'html'

Expand All @@ -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 <a href='${clientNotification.meta.headers.Location}'>here</a>`))
} 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)
Expand Down
2 changes: 1 addition & 1 deletion packages/jsreport-reports/test/reportsTest.js
Expand Up @@ -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
})

Expand Down

0 comments on commit 0842b50

Please sign in to comment.