(t *testing.T)
| 742 | } |
| 743 | |
| 744 | func TestOptionsSuccessStatusCodeDefault(t *testing.T) { |
| 745 | s := New(Options{ |
| 746 | // Intentionally left blank. |
| 747 | }) |
| 748 | |
| 749 | req, _ := http.NewRequest("OPTIONS", "http://example.com/foo", nil) |
| 750 | req.Header.Add("Access-Control-Request-Method", "GET") |
| 751 | |
| 752 | t.Run("Handler", func(t *testing.T) { |
| 753 | res := httptest.NewRecorder() |
| 754 | s.Handler(testHandler).ServeHTTP(res, req) |
| 755 | assertResponse(t, res, http.StatusNoContent) |
| 756 | }) |
| 757 | t.Run("HandlerFunc", func(t *testing.T) { |
| 758 | res := httptest.NewRecorder() |
| 759 | s.HandlerFunc(res, req) |
| 760 | assertResponse(t, res, http.StatusNoContent) |
| 761 | }) |
| 762 | t.Run("Negroni", func(t *testing.T) { |
| 763 | res := httptest.NewRecorder() |
| 764 | s.ServeHTTP(res, req, testHandler) |
| 765 | assertResponse(t, res, http.StatusNoContent) |
| 766 | }) |
| 767 | } |
| 768 | |
| 769 | func TestOptionsSuccessStatusCodeOverride(t *testing.T) { |
| 770 | s := New(Options{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…