Skip to content

Commit

Permalink
Add test case where request is send as a chunked-encoded request
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksontj committed Apr 18, 2018
1 parent b0f39d5 commit cdf19f8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"time"

"context"

"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
Expand Down Expand Up @@ -667,6 +668,20 @@ func testAdditionalBindings(t *testing.T, port int) {
}
return resp
},
func() *http.Response {
r, w := io.Pipe()
go func() {
defer w.Close()
w.Write([]byte(`"hello"`))
}()
url := fmt.Sprintf("http://localhost:%d/v2/example/echo", port)
resp, err := http.Post(url, "application/json", r)
if err != nil {
t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err)
return nil
}
return resp
},
func() *http.Response {
url := fmt.Sprintf("http://localhost:%d/v2/example/echo?value=hello", port)
resp, err := http.Get(url)
Expand Down

0 comments on commit cdf19f8

Please sign in to comment.