func TestForwardHopHeaders(t *testing.T) {
	called := false
	var outHeaders http.Header
	var outHost, expectedHost string
	srv := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {
		called = true
		outHeaders = req.Header
		outHost = req.Host
		w.Write([]byte("hello"))
	})
	defer srv.Close()
	f, err := New()
	require.NoError(t, err)
	proxy := testutils.NewHandler(func(w http.ResponseWriter, req *http.Request) {
		req.URL = testutils.ParseURI(srv.URL)
		expectedHost = req.URL.Host
		f.ServeHTTP(w, req)
	})
	defer proxy.Close()
	headers := http.Header{
		Connection: []string{"close"},
		KeepAlive:  []string{"timeout=600"},
	}
	re, body, err := testutils.Get(proxy.URL, testutils.Headers(headers))
	require.NoError(t, err)
	assert.Equal(t, "hello", string(body))
	assert.Equal(t, http.StatusOK, re.StatusCode)
	assert.Equal(t, true, called)
	assert.Equal(t, "", outHeaders.Get(Connection))
	assert.Equal(t, "", outHeaders.Get(KeepAlive))
	assert.Equal(t, expectedHost, outHost)
}
Makes sure hop-by-hop headers are removed
package forward
import (
	"context"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"net/url"
	"testing"
	"time"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/vulcand/oxy/testutils"
	"github.com/vulcand/oxy/utils"
)