Skip to content

Commit 214cdd5

Browse files
committed
Work-around for: mfi.Server.GET(route, func literal) used as value
1 parent ef1bb8d commit 214cdd5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ if exists {
157157
* ``.UpdateOnInterval(interval time.Duration) *time.Ticker`` Keep updating regularly on a duration
158158
* ``.ServeFile(c echo.Context, filename string) error``
159159
* ``.ServeMF(c echo.Context, memFile *MemFile) error``
160-
* ``.ServeMemFile(route string, filename string) *echo.Route`` shorthand handler
160+
* ``.ServeMemFile(route string, filename string)`` shorthand handler
161161
* ``.Serve(res http.ResponseWriter, req *http.Request, filename string) error`` for other middleware etc.
162162
* ``.CacheControl`` the Cache-Control header is ``"private, must-revalidate"`` by default, but you can change it
163163
* ``.DevMode``

memfile.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,13 @@ func ServablePath(dir string, loc string) string {
245245
return loc
246246
}
247247

248-
func (mfi *MemFileInstance) ServeMemFile(route string, filename string) *echo.Route {
248+
func (mfi *MemFileInstance) ServeMemFile(route string, filename string) {
249249
loc := filename
250250
if loc[:1] != slash {
251251
loc = slash + loc
252252
}
253-
return mfi.Server.GET(route, func(c ctx) error {
253+
254+
mfi.Server.GET(route, func(c ctx) error {
254255
return mfi.Serve(c.Response().Writer, c.Request(), loc)
255256
})
256257
}

0 commit comments

Comments
 (0)