diff --git a/Rest.Net/HttpListenerResponseExtensions.cs b/Rest.Net/HttpListenerResponseExtensions.cs index 7ecbdd2..dc2ff38 100644 --- a/Rest.Net/HttpListenerResponseExtensions.cs +++ b/Rest.Net/HttpListenerResponseExtensions.cs @@ -118,21 +118,21 @@ namespace MontoyaTech.Rest.Net /// Sets the response content type to a file and writes the file content with name to the response. /// /// - /// + /// /// /// /// /// - public static HttpListenerResponse WithFile(this HttpListenerResponse response, string fileName, byte[] content, string mimeType = null) + public static HttpListenerResponse WithFile(this HttpListenerResponse response, string filePath, byte[] content, string mimeType = null) { - if (string.IsNullOrWhiteSpace(fileName)) - throw new ArgumentException("fileName must not be null or empty"); + if (string.IsNullOrWhiteSpace(filePath)) + throw new ArgumentException("filePath must not be null or empty"); if (string.IsNullOrWhiteSpace(mimeType)) - mimeType = Path.GetExtension(fileName).GetMimeType(); + mimeType = Path.GetExtension(filePath).GetMimeType(); response.ContentType = mimeType; - response.Headers.Add("Content-Deposition", $@"attachment; filename=""{Path.GetFileName(fileName)}"""); + response.Headers.Add("Content-Deposition", $@"attachment; filename=""{Path.GetFileName(filePath)}"""); response.SendChunked = true; using (var responseStream = response.OutputStream) @@ -173,21 +173,21 @@ namespace MontoyaTech.Rest.Net /// Sets the response content type to a file and writes the file content with name to the response. /// /// - /// + /// /// /// /// /// - public static HttpListenerResponse WithCompressedFile(this HttpListenerResponse response, string fileName, byte[] content, string mimeType = null) + public static HttpListenerResponse WithCompressedFile(this HttpListenerResponse response, string filePath, byte[] content, string mimeType = null) { - if (string.IsNullOrWhiteSpace(fileName)) + if (string.IsNullOrWhiteSpace(filePath)) throw new ArgumentException("filePath must not be null or empty"); if (string.IsNullOrWhiteSpace(mimeType)) - mimeType = Path.GetExtension(fileName).GetMimeType(); + mimeType = Path.GetExtension(filePath).GetMimeType(); response.ContentType = mimeType; - response.Headers.Add("Content-Deposition", $@"attachment; filename=""{Path.GetFileName(fileName)}"""); + response.Headers.Add("Content-Deposition", $@"attachment; filename=""{Path.GetFileName(filePath)}"""); response.Headers.Add("Content-Encoding", "gzip"); response.SendChunked = true;