File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
mocks/r4/requestUrlForFileDownload Expand file tree Collapse file tree 2 files changed +4
-8
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 11module . 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 }
You can’t perform that action at this time.
0 commit comments