use a better mockStream in h2quic tests

This commit is contained in:
Marten Seemann
2016-12-16 10:32:46 +07:00
parent a7afd72795
commit a8bbe66d5c
4 changed files with 34 additions and 30 deletions

View File

@@ -45,7 +45,7 @@ var _ = Describe("Request", func() {
req, err := http.NewRequest("GET", "https://quic.clemente.io/index.html?foo=bar", nil)
Expect(err).ToNot(HaveOccurred())
rw.WriteRequest(req, 1337)
headerFrame, headerFields := decode(headerStream.Bytes())
headerFrame, headerFields := decode(headerStream.dataWritten.Bytes())
Expect(headerFrame.StreamID).To(Equal(uint32(1337)))
Expect(headerFrame.HasPriority()).To(BeTrue())
Expect(headerFields).To(HaveKeyWithValue(":authority", "quic.clemente.io"))
@@ -60,7 +60,7 @@ var _ = Describe("Request", func() {
req, err := http.NewRequest("POST", "https://quic.clemente.io/upload.html", strings.NewReader(form.Encode()))
Expect(err).ToNot(HaveOccurred())
rw.WriteRequest(req, 5)
_, headerFields := decode(headerStream.Bytes())
_, headerFields := decode(headerStream.dataWritten.Bytes())
Expect(headerFields).To(HaveKeyWithValue(":method", "POST"))
Expect(headerFields).To(HaveKey("content-length"))
contentLength, err := strconv.Atoi(headerFields["content-length"])
@@ -82,7 +82,7 @@ var _ = Describe("Request", func() {
req.AddCookie(cookie1)
req.AddCookie(cookie2)
rw.WriteRequest(req, 11)
_, headerFields := decode(headerStream.Bytes())
_, headerFields := decode(headerStream.dataWritten.Bytes())
Expect(headerFields).To(HaveKeyWithValue("cookie", "Cookie #1=Value #1; Cookie #2=Value #2"))
})
})