Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

goreq.Request.Timeout behavior is different from http.Client.Timeout #116

Open
defia opened this issue Oct 6, 2015 · 4 comments
Open

goreq.Request.Timeout behavior is different from http.Client.Timeout #116

defia opened this issue Oct 6, 2015 · 4 comments

Comments

@defia
Copy link
Contributor

defia commented Oct 6, 2015

http://play.golang.org/p/Fjv_Bf_UyH
hangs on ioutil.ReadAll

http://play.golang.org/p/TsXX5MyMC4
timeout works.

we have to override goreq.DefaultClient to set timeout flawlessly

@sschepens
Copy link
Contributor

It seems to me that this happens because we wrap Body in our own object and we're not closing it on faliure, should be easy to fix.

@sschepens
Copy link
Contributor

Ok, this is a little more complicated, goreq stops the timer when request is answered, it doesn't care about the request body. I have to check what go does in this case, maybe we could set read timeout to that value or make timer stop when request body is closed.
We would need to replicate this behaviour: https://golang.org/src/net/http/client.go#L530

@sschepens
Copy link
Contributor

I'll see if I have time on the weekend to get this done

Antman2023 added a commit to Antman2023/goreq that referenced this issue Dec 10, 2015
@marcosnils
Copy link
Member

@defia this should be fixed in the latest goreq. Can you please check?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants