diff --git a/Rest.Net/HttpListenerResponseExtensions.cs b/Rest.Net/HttpListenerResponseExtensions.cs index 8d74f48..058731b 100644 --- a/Rest.Net/HttpListenerResponseExtensions.cs +++ b/Rest.Net/HttpListenerResponseExtensions.cs @@ -379,14 +379,17 @@ namespace MontoyaTech.Rest.Net /// /// /// + /// If set, sets the content type to this value. If null, and no content type is set, sets it to octet-stream. /// This response. /// - public static HttpListenerResponse WithStream(this HttpListenerResponse response, Stream stream) + public static HttpListenerResponse WithStream(this HttpListenerResponse response, Stream stream, string mimeType = null) { if (stream == null) throw new ArgumentNullException($"{nameof(stream)} cannot be null."); - if (string.IsNullOrWhiteSpace(response.ContentType)) + if (!string.IsNullOrWhiteSpace(mimeType)) + response.ContentType = mimeType; + else if (string.IsNullOrWhiteSpace(response.ContentType)) response.ContentType = "application/octet-stream"; try diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index 2d1b2c9..f6ffd34 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.8.6 + 1.8.7 Logo_Symbol_Black_Outline.png