C# WebAPI Return Stream As Response

Date: 2021-01-21
public static HttpResponseMessage ConvertStreamToResponseType(this System.IO.Stream stream, string mediaTypeHeaderValue)
{
	stream.Position = 0;
	var response = new HttpResponseMessage(HttpStatusCode.OK)
	{
		Content = new StreamContent(stream)
	};
	response.Content.Headers.ContentType = new MediaTypeHeaderValue(mediaTypeHeaderValue);
	return response;
}
44770cookie-checkC# WebAPI Return Stream As Response