MCPcopy Create free account
hub / github.com/WICG/webpackage / createTestBundleWithVariants

Function createTestBundleWithVariants

go/bundle/bundle_test.go:63–95  ·  view source on GitHub ↗
(ver version.Version)

Source from the content-addressed store, hash-verified

61}
62
63func createTestBundleWithVariants(ver version.Version) *Bundle {
64 primaryURL := urlMustParse("https://variants.example.com/")
65 return &Bundle{
66 Version: ver,
67 PrimaryURL: primaryURL,
68 Exchanges: []*Exchange{
69 &Exchange{
70 Request{URL: primaryURL},
71 Response{
72 Status: 200,
73 Header: http.Header{
74 "Content-Type": []string{"text/plain"},
75 "Variants": []string{"Accept-Language;en;ja"},
76 "Variant-Key": []string{"en"},
77 },
78 Body: []byte("Hello, world!"),
79 },
80 },
81 &Exchange{
82 Request{URL: primaryURL},
83 Response{
84 Status: 200,
85 Header: http.Header{
86 "Content-Type": []string{"text/plain"},
87 "Variants": []string{"Accept-Language;en;ja"},
88 "Variant-Key": []string{"ja"},
89 },
90 Body: []byte("こんにちは世界"),
91 },
92 },
93 },
94 }
95}
96
97func createTestCerts(t *testing.T) []*certurl.AugmentedCertificate {
98 certs, err := signingalgorithm.ParseCertificates([]byte(pemCerts))

Callers 1

Calls 1

urlMustParseFunction · 0.70

Tested by

no test coverage detected