Simplifies c.File()

This commit is contained in:
Manu Mtz-Almeida 2015-05-21 15:49:10 +02:00
parent caa75c6201
commit 66251d1741
3 changed files with 1 additions and 18 deletions

View File

@ -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{}) {

View File

@ -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
}

View File

@ -18,7 +18,6 @@ var (
_ Render = Redirect{}
_ Render = Data{}
_ Render = HTML{}
_ Render = File{}
_ HTMLRender = HTMLDebug{}
_ HTMLRender = HTMLProduction{}
)