You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: request_test.go
    path of file: ./repos/k6/js/modules/k6/http
    
    the code of the file until where you have to start completion: package http

import (
	"bytes"
	"compress/g
    
func TestRequestAndBatchTLS(t *testing.T) {
	t.Parallel()

	t.Run("cert_expired", func(t *testing.T) {
		t.Parallel()
		ts := newTestCase(t)
		rt := ts.runtime.VU.Runtime()
		state := ts.runtime.VU.State()

		cert, key := GenerateTLSCertificate(t, "expired.localhost", time.Now().Add(-time.Hour), 0)
		s, client := GetTestServerWithCertificate(t, cert, key)
		go func() {
			_ = s.Config.Serve(s.Listener)
		}()
		t.Cleanup(func() {
			require.NoError(t, s.Config.Close())
		})
		host, port, err := net.SplitHostPort(s.Listener.Addr().String())
		require.NoError(t, err)
		ip := net.ParseIP(host)
		mybadsslHostname, err := types.NewHost(ip, port)
		require.NoError(t, err)
		state.Transport = client.Transport
		state.TLSConfig = s.TLS
		state.Dialer = &netext.Dialer{
			Hosts: func() *types.Hosts {
				hosts, er := types.NewHosts(map[string]types.Host{"expired.localhost": *mybadsslHostname})
				require.NoError(t, er)
				return hosts
			}(),
		}
		client.Transport.(*http.Transport).DialContext = state.Dialer.DialContext //nolint:forcetypeassert
		_, err = rt.RunString(`throw JSON.stringify(http.get("https://expired.localhost/"));`)
		require.Error(t, err)
		assert.Contains(t, err.Error(), "x509: certificate has expired or is not yet valid")
	})
	tlsVersionTests := []struct {
		Name, URL, Version string
	}{
		{Name: "tls10", URL: "tlsv10.localhost", Version: "http.TLS_1_0"},
		{Name: "tls11", URL: "tlsv11.localhost", Version: "http.TLS_1_1"},
		{Name: "tls12", URL: "tlsv12.localhost", Version: "http.TLS_1_2"},
	}
	for _, versionTest := range tlsVersionTests {
		versionTest := versionTest
		t.Run(versionTest.Name, func(t *testing.T) {
			t.Parallel()
			ts := newTestCase(t)
			samples := ts.samples
			rt := ts.runtime.VU.Runtime()
			state := ts.runtime.VU.State()

			cert, key := GenerateTLSCertificate(t, versionTest.URL, time.Now(), time.Hour)
			s, client := GetTestServerWithCertificate(t, cert, key)

			switch versionTest.Name {
			case "tls10":
				s.TLS.MaxVersion = tls.VersionTLS10
			case "tls11":
				s.TLS.MaxVersion = tls.VersionTLS11
			case "tls12":
				s.TLS.MaxVersion = tls.VersionTLS12
			default:
				panic(versionTest.Name + " unsupported")
			}
			go func() {
				_ = s.Config.Serve(s.Listener)
			}()
			t.Cleanup(func() {
				require.NoError(t, s.Config.Close())
			})
			host, port, err := net.SplitHostPort(s.Listener.Addr().String())
			require.NoError(t, err)
			ip := net.ParseIP(host)
			mybadsslHostname, err := types.NewHost(ip, port)
			require.NoError(t, err)
			hosts, err := types.NewHosts(map[string]types.Host{
				versionTest.URL: *mybadsslHostname,
			})
			require.NoError(t, err)
			state.Dialer = &netext.Dialer{Hosts: hosts}
			state.Transport = client.Transport
			state.TLSConfig = s.TLS
			client.Transport.(*http.Transport).DialContext = state.Dialer.DialContext //nolint:forcetypeassert
			realURL := "https://" + versionTest.URL + "/"
			_, err = rt.RunString(fmt.Sprintf(`
            var res = http.get("%s");
					if (res.tls_version != %s) { throw new Error("wrong TLS version: " + res.tls_version); }
				`, realURL, versionTest.Version))
			assert.NoError(t, err)
			assertRequestMetricsEmitted(t, metrics.GetBufferedSamples(samples), "GET", realURL, 200, "")
		})
	}
	tlsCipherSuiteTests := []struct {
		Name, URL, CipherSuite string
		suite                  uint16
	}{
		{Name: "cipher_suite_cbc", URL: "cbc.localhost", CipherSuite: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", suite: tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA}, // TODO fix this to RSA instead of ECDSA
		{Name: "cipher_suite_ecc384", URL: "ecc384.localhost", CipherSuite: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", suite: tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256},
	}
	for _, cipherSuiteTest := range tlsCipherSuiteTests {
		cipherSuiteTest := cipherSuiteTest
		t.Run(cipherSuiteTest.Name, func(t *testing.T) {
			t.Parallel()
			ts := newTestCase(t)
			samples := ts.samples
			rt := ts.runtime.VU.Runtime()
			state := ts.runtime.VU.State()
			cert, key := GenerateTLSCertificate(t, cipherSuiteTest.URL, time.Now(), time.Hour)
			s, client := GetTestServerWithCertificate(t, cert, key, cipherSuiteTest.suite)
			go func() {
				_ = s.Config.Serve(s.Listener)
			}()
			t.Cleanup(func() {
				require.NoError(t, s.Config.Close())
			})
			host, port, err := net.SplitHostPort(s.Listener.Addr().String())
			require.NoError(t, err)
			ip := net.ParseIP(host)
			mybadsslHostname, err := types.NewHost(ip, port)
			require.NoError(t, err)
			hosts, err := types.NewHosts(map[string]types.Host{
				cipherSuiteTest.URL: *mybadsslHostname,
			})
			require.NoError(t, err)
			state.Dialer = &netext.Dialer{Hosts: hosts}
			state.Transport = client.Transport
			state.TLSConfig = s.TLS
			client.Transport.(*http.Transport).DialContext = state.Dialer.DialContext //nolint:forcetypeassert
			realURL := "https://" + cipherSuiteTest.URL + "/"
			_, err = rt.RunString(fmt.Sprintf(`
					var res = http.get("%s");
					if (res.tls_cipher_suite != "%s") { throw new Error("wrong TLS cipher suite: " + res.tls_cipher_suite); }
				`, realURL, cipherSuiteTest.CipherSuite))
			assert.NoError(t, err)
			assertRequestMetricsEmitted(t, metrics.GetBufferedSamples(samples), "GET", realURL, 200, "")
		})
	}
	t.Run("ocsp_stapled_good", func(t *testing.T) {
		t.Parallel()
		if runtime.GOOS == "windows" {
			t.Skip("this doesn't work on windows for some reason")
		}
		website := "https://www.wikipedia.org/"
		ts := newTestCase(t)
		tb := ts.tb
		samples := ts.samples
		rt := ts.runtime.VU.Runtime()
		state := ts.runtime.VU.State()
		state.Dialer = tb.Dialer
		_, err := rt.RunString(fmt.Sprintf(`
			var res = http.request("GET", "%s");
			if (res.ocsp.status != http.OCSP_STATUS_GOOD) { throw new Error("wrong ocsp stapled response status: " + res.ocsp.status); }
			`, website))
		assert.NoError(t, err)
		assertRequestMetricsEmitted(t, metrics.GetBufferedSamples(samples), "GET", website, 200, "")
	})
}