Reputation: 281
In the somewhat contrived code snippet below I have created a controller method which forms part of a ASP.NET Core MVC API. The method is decorated with the ProducesResponseType
attribute, is it correct to indicate the response type is a Stream
, or should the response type be FileStreamResult
?
[HttpPost("APIFunctionCall")]
[ProducesResponseType(typeof(Stream), 200)]
public async Task<IActionResult> ProcessNewRequestAsync(Request request)
{
FileStream fs = File.Open(request.Path, FileMode.Open, FileAccess.Read, FileShare.None)
return returnValue = new FileStreamResult(fs, new MediaTypeHeaderValue("application/ms-word"));
}
Upvotes: 6
Views: 4772
Reputation: 77934
Should be FileStream
or FileStreamResult
instead I would say
[ProducesResponseType(typeof(FileStreamResult), 200)]
Upvotes: 11