| 600 | } |
| 601 | |
| 602 | func TestStartConfig_WithBeforeServeFunc(t *testing.T) { |
| 603 | e := New() |
| 604 | |
| 605 | e.GET("/ok", func(c *Context) error { |
| 606 | return c.String(http.StatusOK, "OK") |
| 607 | }) |
| 608 | |
| 609 | s := &StartConfig{ |
| 610 | Address: ":0", |
| 611 | BeforeServeFunc: func(s *http.Server) error { |
| 612 | return errors.New("is called before serve") |
| 613 | }, |
| 614 | } |
| 615 | err := s.Start(stdContext.Background(), e) |
| 616 | assert.EqualError(t, err, "is called before serve") |
| 617 | } |
| 618 | |
| 619 | func TestStartConfig_WithHTTP2WithCustomTlsConfig(t *testing.T) { |
| 620 | var testCases = []struct { |