aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/requestwrite_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/requestwrite_test.go')
-rw-r--r--src/net/http/requestwrite_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/net/http/requestwrite_test.go b/src/net/http/requestwrite_test.go
index eb65b9f736..246fb4e65d 100644
--- a/src/net/http/requestwrite_test.go
+++ b/src/net/http/requestwrite_test.go
@@ -512,6 +512,38 @@ var reqWriteTests = []reqWriteTest{
"User-Agent: Go-http-client/1.1\r\n" +
"\r\n",
},
+
+ // CONNECT without Opaque
+ 21: {
+ Req: Request{
+ Method: "CONNECT",
+ URL: &url.URL{
+ Scheme: "https", // of proxy.com
+ Host: "proxy.com",
+ },
+ },
+ // What we used to do, locking that behavior in:
+ WantWrite: "CONNECT proxy.com HTTP/1.1\r\n" +
+ "Host: proxy.com\r\n" +
+ "User-Agent: Go-http-client/1.1\r\n" +
+ "\r\n",
+ },
+
+ // CONNECT with Opaque
+ 22: {
+ Req: Request{
+ Method: "CONNECT",
+ URL: &url.URL{
+ Scheme: "https", // of proxy.com
+ Host: "proxy.com",
+ Opaque: "backend:443",
+ },
+ },
+ WantWrite: "CONNECT backend:443 HTTP/1.1\r\n" +
+ "Host: proxy.com\r\n" +
+ "User-Agent: Go-http-client/1.1\r\n" +
+ "\r\n",
+ },
}
func TestRequestWrite(t *testing.T) {