(t *testing.T)
| 767 | } |
| 768 | |
| 769 | func TestOptionsSuccessStatusCodeOverride(t *testing.T) { |
| 770 | s := New(Options{ |
| 771 | OptionsSuccessStatus: http.StatusOK, |
| 772 | }) |
| 773 | |
| 774 | req, _ := http.NewRequest("OPTIONS", "http://example.com/foo", nil) |
| 775 | req.Header.Add("Access-Control-Request-Method", "GET") |
| 776 | |
| 777 | t.Run("Handler", func(t *testing.T) { |
| 778 | res := httptest.NewRecorder() |
| 779 | s.Handler(testHandler).ServeHTTP(res, req) |
| 780 | assertResponse(t, res, http.StatusOK) |
| 781 | }) |
| 782 | t.Run("HandlerFunc", func(t *testing.T) { |
| 783 | res := httptest.NewRecorder() |
| 784 | s.HandlerFunc(res, req) |
| 785 | assertResponse(t, res, http.StatusOK) |
| 786 | }) |
| 787 | t.Run("Negroni", func(t *testing.T) { |
| 788 | res := httptest.NewRecorder() |
| 789 | s.ServeHTTP(res, req, testHandler) |
| 790 | assertResponse(t, res, http.StatusOK) |
| 791 | }) |
| 792 | } |
| 793 | |
| 794 | func TestAccessControlExposeHeadersPresence(t *testing.T) { |
| 795 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…