Renamed fileName back to filePath
This commit is contained in:
		@@ -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.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="response"></param>
 | 
			
		||||
        /// <param name="fileName"></param>
 | 
			
		||||
        /// <param name="filePath"></param>
 | 
			
		||||
        /// <param name="content"></param>
 | 
			
		||||
        /// <param name="mimeType"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        /// <exception cref="ArgumentException"></exception>
 | 
			
		||||
        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.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="response"></param>
 | 
			
		||||
        /// <param name="fileName"></param>
 | 
			
		||||
        /// <param name="filePath"></param>
 | 
			
		||||
        /// <param name="content"></param>
 | 
			
		||||
        /// <param name="mimeType"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        /// <exception cref="ArgumentException"></exception>
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user