package proxy import ( "io" "net/http" "net/http/httptest" "testing" "sneak.berlin/go/smallwebwaf/internal/config" ) func TestAnAnswerWithoutAContentTypeGetsNone(t *testing.T) { t.Parallel() srv := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, _ *http.Request) { rq := &request{ h: &handler{config: &config.Config{}}, out: &responseWriter{ResponseWriter: w}, } app := &http.Response{ StatusCode: http.StatusOK, Header: http.Header{}, Body: http.NoBody, } err := rq.modifyResponse(app) if err != nil { t.Errorf("modifyResponse: %v", err) } // The headers go out with this, the first part of the body, // which Go's server would guess a Content-Type from. _, _ = io.WriteString(w, "