From 65d615f43ebbdfbc48ce1792c727ebef47304dfb Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 13 Apr 2026 11:57:46 +0200 Subject: [PATCH] Support inline PDF display or download via query param Add a 'download' query parameter to DocResultController's GetAsync method. This lets clients choose whether to download the PDF or display it inline by setting the 'download' parameter in the request. --- .../Controllers/DocResultController.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs b/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs index bd59b946..920c5902 100644 --- a/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs +++ b/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs @@ -9,8 +9,13 @@ namespace EnvelopeGenerator.ServiceHost.Controllers; public class DocResultController(IMediator mediator) : ControllerBase { [HttpGet] - public async Task GetAsync([FromQuery] ReadSingleEnvelopeDocResultQuery query, CancellationToken cancel = default) + public async Task GetAsync([FromQuery] ReadSingleEnvelopeDocResultQuery query, [FromQuery] bool download = false, CancellationToken cancel = default) { - return File(await mediator.Send(query, cancel), "application/pdf", $"envelope_{query.Envelope.Uuid}.pdf"); + var bytes = await mediator.Send(query, cancel); + + if (download) + return File(bytes, "application/pdf", $"envelope_{query.Envelope.Uuid}.pdf"); + + return File(bytes, "application/pdf"); } } \ No newline at end of file