Commit 5436c957 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

integration: Add HTTP/2 chunked request body test

parent 46756558
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"github.com/bradfitz/http2" "github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack" "github.com/bradfitz/http2/hpack"
"io/ioutil"
"net/http" "net/http"
"testing" "testing"
) )
...@@ -173,3 +174,30 @@ func TestHTTP2LocationRewrite(t *testing.T) { ...@@ -173,3 +174,30 @@ func TestHTTP2LocationRewrite(t *testing.T) {
t.Errorf("Location: %v; want %v", got, want) t.Errorf("Location: %v; want %v", got, want)
} }
} }
func TestHTTP2ChunkedRequestBody(t *testing.T) {
st := newServerTester(nil, t, func(w http.ResponseWriter, r *http.Request) {
want := "[chunked]"
if got := fmt.Sprint(r.TransferEncoding); got != want {
t.Errorf("Transfer-Encoding: %v; want %v", got, want)
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
t.Errorf("Error reading r.body: %v", err)
}
want = "foo"
if got := string(body); got != want {
t.Errorf("body: %v; want %v", got, want)
}
})
defer st.Close()
_, err := st.http2(requestParam{
name: "TestHTTP2ChunkedRequestBody",
method: "POST",
body: []byte("foo"),
})
if err != nil {
t.Errorf("Error st.http2() = %v", err)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment