From bd4f5f63b6d44379c208ef414e784d83452a3a0e Mon Sep 17 00:00:00 2001 From: MattMo Date: Wed, 1 Mar 2023 16:33:41 -0800 Subject: [PATCH] Renamed fileName back to filePath --- Rest.Net/HttpListenerResponseExtensions.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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;