Observed behavior
router.post('/actions/generer-le-courrier-assureur', permissionMiddlewareCreator.smartAction(), async (request, response) => {
const id = request.body.data.attributes.ids[0];
superagent
.get(`${API_VISIT}/litigation/damage/generate_document/${id}`)
.set('Authorization', `Bearer ${process.env.ACCESS_TOKEN}`)
.set('X-CURRENT-USER-EMAIL', request.user.email)
// .buffer(true)
// .disableTLSCerts()
.end((err, res) => {
response.setHeader('Content-Type', 'application/vnd.oasis.opendocument.text');
response.setHeader('Content-Disposition', 'attachment; filename="blank_letter_so.odt"');
// response.setHeader('Content-Disposition', 'attachment; filename="blank_letter_so.pdf"');
//response.setHeader('Content-Disposition', 'attachment; filename="blank_letter_so.docx"');
response.setHeader('Access-Control-Expose-Headers', 'Content-Disposition');
response.send(res.body);
});
});
When I validate the action, the document does not appear, it shows me this:
Context
Project name: .Sergic
Team name: gestion
Environment name: Développement
Agent (forest package) name & version: 9
Database type: Postgres