From 4968da25f3cbd3a98aeffb6da904192256668f11 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Sun, 22 Dec 2024 10:42:56 -0500 Subject: [PATCH] change BufferPDF to BufferFile to support any kind of file --- response.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/response.go b/response.go index 525023a..2b1047b 100644 --- a/response.go +++ b/response.go @@ -28,10 +28,10 @@ type header struct { } // TODO add doc -func (rs *Response) BufferPDF(name string, b bytes.Buffer) *Response { +func (rs *Response) BufferFile(name string, filetype string, b bytes.Buffer) *Response { if rs.isTerminated == false { - rs.HttpResponseWriter.Header().Add("Content-Type", "application/pdf") + rs.HttpResponseWriter.Header().Add("Content-Type", filetype) rs.HttpResponseWriter.Header().Add("Content-Disposition", "attachment; filename="+name) b.WriteTo(rs.HttpResponseWriter) }