34 ControllerBase controller,
36 CancellationToken cancellationToken)
38 ArgumentNullException.ThrowIfNull(fileTransferService);
40 ArgumentNullException.ThrowIfNull(controller);
45 var streamAccept =
new MediaTypeHeaderValue(MediaTypeNames.Application.Octet);
46 if (!controller.Request.GetTypedHeaders().Accept.Any(streamAccept.IsSubsetOf))
49 AdditionalData = $
"File downloads must accept both {MediaTypeNames.Application.Octet} and {MediaTypeNames.Application.Json}!",
57 var (stream, errorMessage) = await fileTransferService.
RetrieveDownloadStream(fileTicketResult, cancellationToken);
60 if (errorMessage !=
null)
61 return controller.Conflict(errorMessage);
64 return controller.Gone();
71 await stream.DisposeAsync();