set EndStream header in HeadersFrame

This commit is contained in:
Marten Seemann
2017-01-05 10:53:46 +07:00
parent db09de621c
commit 6dd297379b
4 changed files with 42 additions and 7 deletions

View File

@@ -204,6 +204,21 @@ var _ = Describe("Client", func() {
})
})
It("sets the EndStream header for requests without a body", func() {
go func() { client.Do(request) }()
Eventually(func() []byte { return headerStream.dataWritten.Bytes() }).ShouldNot(BeNil())
mhf := getRequest(headerStream.dataWritten.Bytes())
Expect(mhf.HeadersFrame.StreamEnded()).To(BeTrue())
})
It("sets the EndStream header to false for requests with a body", func() {
request.Body = &mockBody{}
go func() { client.Do(request) }()
Eventually(func() []byte { return headerStream.dataWritten.Bytes() }).ShouldNot(BeNil())
mhf := getRequest(headerStream.dataWritten.Bytes())
Expect(mhf.HeadersFrame.StreamEnded()).To(BeFalse())
})
Context("gzip compression", func() {
var gzippedData []byte // a gzipped foobar
var response *http.Response