| 447 | } |
| 448 | |
| 449 | func TestGroup_Static(t *testing.T) { |
| 450 | e := New() |
| 451 | |
| 452 | g := e.Group("/books") |
| 453 | ri := g.Static("/download", "_fixture") |
| 454 | assert.Equal(t, http.MethodGet, ri.Method) |
| 455 | assert.Equal(t, "/books/download*", ri.Path) |
| 456 | assert.Equal(t, "GET:/books/download*", ri.Name) |
| 457 | assert.Equal(t, []string{"*"}, ri.Parameters) |
| 458 | |
| 459 | req := httptest.NewRequest(http.MethodGet, "/books/download/index.html", nil) |
| 460 | rec := httptest.NewRecorder() |
| 461 | e.ServeHTTP(rec, req) |
| 462 | |
| 463 | assert.Equal(t, http.StatusOK, rec.Code) |
| 464 | body := rec.Body.String() |
| 465 | assert.True(t, strings.HasPrefix(body, "<!doctype html>")) |
| 466 | } |
| 467 | |
| 468 | func TestGroup_StaticMultiTest(t *testing.T) { |
| 469 | var testCases = []struct { |