Simplifies c.File()
This commit is contained in:
parent
caa75c6201
commit
66251d1741
@ -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{}) {
|
||||
|
@ -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
|
||||
}
|
@ -18,7 +18,6 @@ var (
|
||||
_ Render = Redirect{}
|
||||
_ Render = Data{}
|
||||
_ Render = HTML{}
|
||||
_ Render = File{}
|
||||
_ HTMLRender = HTMLDebug{}
|
||||
_ HTMLRender = HTMLProduction{}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user