Skip to content

Commit ef17578

Browse files
sandbox working
1 parent 8b86944 commit ef17578

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

sandbox/src/routes/r4/example_attachment.pdf renamed to sandbox/src/mocks/r4/requestUrlForFileDownload/example_attachment.pdf

File renamed without changes.

sandbox/src/routes/r4/retrieveBinaryHelper.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
module.exports = [
22
/**
33
* Sandbox implementation for retrieveBinary (R4) endpoint helper,
4-
* with an ObjectStore 'mock', allowing redirection and example file retrieval.
4+
* with an ObjectStore 'mock', allowing redirection and simple file retrieval.
55
*/
66
{
77
method: 'GET',
88
path: '/ObjectStore/RetrieveBinary/{fileDownloadUuid}',
99
handler: (request, h) => {
1010

11-
console.log("Here's your attachment.")
1211
const uuid = request.params.fileDownloadUuid
13-
const exampleResponsePath = './example_attachment.pdf'
1412
const filename = 'example_attachment.pdf'
13+
const filePath = `./r4/requestUrlForFileDownload/${filename}`
1514
const responseCode = 200
1615

1716
if (uuid === 'd497bbe3-f88b-45f1-b3d4-9c563e4c0f5f') {
18-
return h.file(exampleResponsePath, {
19-
mode: 'attachment',
20-
filename: filename,
21-
etagMethod: false
22-
}).code(responseCode);
17+
return h.file(filePath).code(responseCode).header('Content-Disposition', `attachment; filename*=UTF-8''${filename}`)
18+
.header('Content-Type', 'application/pdf');
2319
}
2420
}
2521
}

0 commit comments

Comments
 (0)