Skip to content
Myr

support Go v1.16 version (#2638)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by thinkerou · committed by GitHub · parent ee4de84 · Browse files · 3 files+13 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+13 added−3 removed

  • other:+13 added−3 removed

3 files+13 added−3 removed

modified:.travis.yml+4 added
modified:context_test.go+6 added-2 removed
1016 unmodified lines
1017 c.File("./gin.go")10181019 assert.Equal(t, http.StatusOK, w.Code)1020 assert.Contains(t, w.Body.String(), "func New() *Engine {")1021 // Content-Type='text/plain; charset=utf-8' when go version <= 1.16,1022 // else, Content-Type='text/x-go; charset=utf-8'1021 assert.Equal(t, "text/plain; charset=utf-8", w.Header().Get("Content-Type"))1023 assert.NotEqual(t, "", w.Header().Get("Content-Type"))1024}10251026func TestContextRenderFileFromFS(t *testing.T) {1027 w := httptest.NewRecorder()
3 unmodified lines
1031 c.FileFromFS("./gin.go", Dir(".", false))10321033 assert.Equal(t, http.StatusOK, w.Code)1034 assert.Contains(t, w.Body.String(), "func New() *Engine {")1035 // Content-Type='text/plain; charset=utf-8' when go version <= 1.16,1036 // else, Content-Type='text/x-go; charset=utf-8'1033 assert.Equal(t, "text/plain; charset=utf-8", w.Header().Get("Content-Type"))1037 assert.NotEqual(t, "", w.Header().Get("Content-Type"))1038 assert.Equal(t, "/some/path", c.Request.URL.Path)1039}10401041func TestContextRenderAttachment(t *testing.T) {
1015 unmodified lines
modified:routes_test.go+3 added-1 removed
358 unmodified lines
359 w := performRequest(router, http.MethodGet, "/gin.go")360361 assert.Equal(t, http.StatusOK, w.Code)362 assert.Contains(t, w.Body.String(), "package gin")363 // Content-Type='text/plain; charset=utf-8' when go version <= 1.16,364 // else, Content-Type='text/x-go; charset=utf-8'363 assert.Equal(t, "text/plain; charset=utf-8", w.Header().Get("Content-Type"))365 assert.NotEqual(t, "", w.Header().Get("Content-Type"))366 assert.NotEqual(t, w.Header().Get("Last-Modified"), "Mon, 02 Jan 2006 15:04:05 MST")367 assert.Equal(t, "Mon, 02 Jan 2006 15:04:05 MST", w.Header().Get("Expires"))368 assert.Equal(t, "Gin Framework", w.Header().Get("x-GIN"))369}
254 unmodified lines