(t *testing.T)
| 1429 | } |
| 1430 | |
| 1431 | func TestContextRenderFileFromFS(t *testing.T) { |
| 1432 | w := httptest.NewRecorder() |
| 1433 | c, _ := CreateTestContext(w) |
| 1434 | |
| 1435 | c.Request, _ = http.NewRequest(http.MethodGet, "/some/path", nil) |
| 1436 | c.FileFromFS("./gin.go", Dir(".", false)) |
| 1437 | |
| 1438 | assert.Equal(t, http.StatusOK, w.Code) |
| 1439 | assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {") |
| 1440 | // Content-Type='text/plain; charset=utf-8' when go version <= 1.16, |
| 1441 | // else, Content-Type='text/x-go; charset=utf-8' |
| 1442 | assert.NotEmpty(t, w.Header().Get("Content-Type")) |
| 1443 | assert.Equal(t, "/some/path", c.Request.URL.Path) |
| 1444 | } |
| 1445 | |
| 1446 | func TestContextRenderAttachment(t *testing.T) { |
| 1447 | w := httptest.NewRecorder() |
nothing calls this directly
no test coverage detected