diff --git a/context.go b/context.go index 164b6457..ba493ad8 100644 --- a/context.go +++ b/context.go @@ -375,10 +375,7 @@ func (c *Context) Data(code int, contentType string, data []byte) { // Writes the specified file into the body stream func (c *Context) File(filepath string) { - c.Render(-1, render.File{ - Path: filepath, - Request: c.Request, - }) + http.ServeFile(c.Writer, c.Request, filepath) } func (c *Context) SSEvent(name string, message interface{}) { diff --git a/render/file.go b/render/file.go deleted file mode 100644 index dd7c8ece..00000000 --- a/render/file.go +++ /dev/null @@ -1,13 +0,0 @@ -package render - -import "net/http" - -type File struct { - Path string - Request *http.Request -} - -func (r File) Write(w http.ResponseWriter) error { - http.ServeFile(w, r.Request, r.Path) - return nil -} diff --git a/render/render.go b/render/render.go index 57a57249..1bcae933 100644 --- a/render/render.go +++ b/render/render.go @@ -18,7 +18,6 @@ var ( _ Render = Redirect{} _ Render = Data{} _ Render = HTML{} - _ Render = File{} _ HTMLRender = HTMLDebug{} _ HTMLRender = HTMLProduction{} )