Skip to content

Commit

Permalink
Actually use http3 in test
Browse files Browse the repository at this point in the history
  • Loading branch information
rthellend committed Oct 30, 2024
1 parent 54c9f50 commit 91e65bc
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions proxy/quic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ func TestReverseProxyGetPost(t *testing.T) {
body, _, err := httpOp(host, proxy.listener.Addr().String(), path, method, body, extCA, nil)
return body, err
}
return h3Op(host, proxy.listener.Addr().String(), path, method, body, extCA)
qt, ok := proxy.quicTransport.(*netw.QUICTransport)
if !ok {
t.Fatalf("proxy.quicTransport is %T", proxy.quicTransport)
}
return h3Op(host, qt.Addr().String(), path, method, body, extCA)
}

for _, tc := range []struct {
Expand All @@ -316,6 +320,14 @@ func TestReverseProxyGetPost(t *testing.T) {
path: "/",
want: "HTTP/2.0 200 OK\n[http] /\n",
},
{
desc: "H3 HTTP GET /",
host: "http.example.com",
method: "GET",
path: "/",
http3: true,
want: "HTTP/3.0 200 OK\n[http] /\n",
},
{
desc: "HTTP POST /",
host: "http.example.com",
Expand All @@ -338,7 +350,8 @@ func TestReverseProxyGetPost(t *testing.T) {
method: "POST",
path: "/",
body: io.NopCloser(bytes.NewReader([]byte("bar"))),
want: "HTTP/2.0 200 OK\n[http] POST / bar\n",
http3: true,
want: "HTTP/3.0 200 OK\n[http] POST / bar\n",
},
{
desc: "HTTP POST /",
Expand All @@ -354,7 +367,8 @@ func TestReverseProxyGetPost(t *testing.T) {
method: "POST",
path: "/",
body: openOrDie(filename),
want: "HTTP/2.0 200 OK\n[http] POST / foo bar 1 2 3\n",
http3: true,
want: "HTTP/3.0 200 OK\n[http] POST / foo bar 1 2 3\n",
},
{
desc: "HTTPS POST /",
Expand All @@ -370,7 +384,8 @@ func TestReverseProxyGetPost(t *testing.T) {
method: "POST",
path: "/",
body: openOrDie(filename),
want: "HTTP/2.0 200 OK\n[https] POST / foo bar 1 2 3\n",
http3: true,
want: "HTTP/3.0 200 OK\n[https] POST / foo bar 1 2 3\n",
},
} {
got, err := doReq(tc.method, tc.host, tc.path, tc.body, tc.http3)
Expand Down

0 comments on commit 91e65bc

Please sign in to comment.