-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'Client.Endpoint' to not 'cancel' when bufferedStream #776
Changes from 2 commits
c8e2326
1fd618d
d5a7f52
f37c50f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,7 @@ func TestHTTPClient(t *testing.T) { | |
|
||
func TestHTTPClientBufferedStream(t *testing.T) { | ||
var ( | ||
testbody = "testbody" | ||
testbody = string(make([]byte, 6000)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a comment explaining the choice of 6000? Or, better yet, factor it out into a const, e.g. var (
bodysize = 6000 // trigger the foo in the bar package
testbody = bytes.Repeat('a', bodysize)
) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I has not an specific meaning by itself, it big enough to make the test fail hehe. If it where to be over 9000 then we would have to modify the test as the I added the documentation too 👍 |
||
encode = func(context.Context, *http.Request, interface{}) error { return nil } | ||
decode = func(_ context.Context, r *http.Response) (interface{}, error) { | ||
return TestResponse{r.Body, ""}, nil | ||
|
@@ -129,6 +129,8 @@ func TestHTTPClientBufferedStream(t *testing.T) { | |
if !ok { | ||
t.Fatal("response should be TestResponse") | ||
} | ||
defer response.Body.Close() | ||
time.Sleep(time.Second * 1) | ||
|
||
// Check that response body was NOT closed | ||
b := make([]byte, len(testbody)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment here to motivate this wrapper would also be welcome. Something like this, feel free to rephrase if I got something wrong: