Repository: labstack/echo
Pull request #1551 (2020-04-09 23:37:50)

Test Matrix Go Versions
I'm up against an issue where I'm trying to make some test improvements but limited by the differences between `go1.11` and current versions.

I'm attempting to sneak past this limitation by removing `go1.11` from the test matrix and adding `go1.14`.

codecov[bot]: # [Codecov](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=h1) Report
> Merging [#1551](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=desc) into [master](https://codecov.io/gh/labstack/echo/commit/2207c37bf875b40f2f7b14c587c1c3de7581340e&el=desc) will **not change** coverage by `%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/labstack/echo/pull/1551/graphs/tree.svg?width=650&height=150&src=pr&token=vqnT76l79i)](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1551   +/-   ##
=======================================
  Coverage   84.85%   84.85%           
=======================================
  Files          28       28           
  Lines        2166     2166           
=======================================
  Hits         1838     1838           
  Misses        213      213           
  Partials      115      115           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=footer). Last update [2207c37...554c980](https://codecov.io/gh/labstack/echo/pull/1551?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.github/workflows/echo.yml b/.github/workflows/echo.yml
index cfa44e6..1d7508b 100644
--- a/.github/workflows/echo.yml
+++ b/.github/workflows/echo.yml
@@ -17,7 +17,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        go: [1.11, 1.12, 1.13]
+        go: [1.12, 1.13, 1.14]
     name: ${{ matrix.os }} @ Go ${{ matrix.go }}
     runs-on: ${{ matrix.os }}
     steps:
diff --git a/group.go b/group.go
index 5d95825..426bef9 100644
--- a/group.go
+++ b/group.go
@@ -109,7 +109,7 @@ func (g *Group) Static(prefix, root string) {
 
 // File implements `Echo#File()` for sub-routes within the Group.
 func (g *Group) File(path, file string) {
-	g.file(g.prefix+path, file, g.GET)
+	g.file(path, file, g.GET)
 }
 
 // Add implements `Echo#Add()` for sub-routes within the Group.


Test patch:
diff --git a/group_test.go b/group_test.go
index 342cd29..c51fd91 100644
--- a/group_test.go
+++ b/group_test.go
@@ -1,7 +1,9 @@
 package echo
 
 import (
+	"io/ioutil"
 	"net/http"
+	"net/http/httptest"
 	"testing"
 
 	"github.com/stretchr/testify/assert"
@@ -26,6 +28,19 @@ func TestGroup(t *testing.T) {
 	g.File("/walle", "_fixture/images//walle.png")
 }
 
+func TestGroupFile(t *testing.T) {
+	e := New()
+	g := e.Group("/group")
+	g.File("/walle", "_fixture/images/walle.png")
+	expectedData, err := ioutil.ReadFile("_fixture/images/walle.png")
+	assert.Nil(t, err)
+	req := httptest.NewRequest(http.MethodGet, "/group/walle", nil)
+	rec := httptest.NewRecorder()
+	e.ServeHTTP(rec, req)
+	assert.Equal(t, http.StatusOK, rec.Code)
+	assert.Equal(t, expectedData, rec.Body.Bytes())
+}
+
 func TestGroupRouteMiddleware(t *testing.T) {
 	// Ensure middleware slices are not re-used
 	e := New()
diff --git a/response_test.go b/response_test.go
index bc570a5..07776ca 100644
--- a/response_test.go
+++ b/response_test.go
@@ -41,3 +41,13 @@ func TestResponse_Write_UsesSetResponseCode(t *testing.T) {
 	res.Write([]byte("test"))
 	assert.Equal(t, http.StatusBadRequest, rec.Code)
 }
+
+func TestResponse_Flush(t *testing.T) {
+	e := New()
+	rec := httptest.NewRecorder()
+	res := &Response{echo: e, Writer: rec}
+
+	res.Write([]byte("test"))
+	res.Flush()
+	assert.True(t, rec.Flushed)
+}