Explorar o código

Adds context.File(path)

Manu Mtz-Almeida %!s(int64=11) %!d(string=hai) anos
pai
achega
8ed55606c3
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      context.go

+ 5 - 0
context.go

@@ -255,3 +255,8 @@ func (c *Context) Data(code int, contentType string, data []byte) {
 	}
 	}
 	c.Writer.Write(data)
 	c.Writer.Write(data)
 }
 }
+
+// Writes the specified file into the body stream
+func (c *Context) File(filepath string) {
+	http.ServeFile(c.Writer, c.Request, filepath)
+}