Re: [go-nuts] Re: ioutil.ReadAll()

2021-07-05 Thread ANKIT KUMAR
resp, err := http.Get("http://example.com/;) if err != nil { // handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) That err returned from ReadAll. how to sloved On Saturday, February 17, 2018 at 2:23:10 PM UTC+5:30 patri...@gmail.com wrote: > > Den 2018-02-14 kl.

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-17 Thread Patrik Iselind
Den 2018-02-14 kl. 11:42, skrev Axel Wagner: Why are the things mentioned so far not sufficient? The presented reasons are enough. I was just seeing things the wrong way and it took quite a while to get my head on straight. After some consideration i have repaired my views and everything is

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-14 Thread matthewjuran
The source for ioutil.ReadAll() shows that it can return a bytes.ErrTooLarge or an error from the io.Reader. So what you're saying is that unless the response contain chunked data, > ioutil.ReadAll() will never fail? I thought typically the http response isn’t buffered into memory first, so

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-14 Thread 'Axel Wagner' via golang-nuts
Why are the things mentioned so far not sufficient? ReadAll returns a non-nil error, if the reader you are passing to it returns a non-nil, non-EOF error. In this case, you are passing Response.Body , which does not make any guarantees regarding the errors

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-14 Thread mrx
On Wed, Feb 14, 2018 at 10:30 AM, Axel Wagner wrote: > > On Wed, Feb 14, 2018 at 10:01 AM mrx wrote: > >> >> On Tue, Feb 13, 2018 at 5:26 PM, Axel Wagner < >> axel.wagner...@googlemail.com> wrote: >> >>> Not very, but it does depend on the

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-14 Thread 'Axel Wagner' via golang-nuts
On Wed, Feb 14, 2018 at 10:01 AM mrx wrote: > > On Tue, Feb 13, 2018 at 5:26 PM, Axel Wagner < > axel.wagner...@googlemail.com> wrote: > >> Not very, but it does depend on the details. For example, you might >> provide your own http.Transport for the client to use, or even

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-14 Thread mrx
On Tue, Feb 13, 2018 at 5:26 PM, Axel Wagner wrote: > Not very, but it does depend on the details. For example, you might > provide your own http.Transport for the client to use, or even your own > net.Conn. > Using ioutils.ReadAll() on a HTTP request means to me

Re: [go-nuts] Re: ioutil.ReadAll()

2018-02-13 Thread 'Axel Wagner' via golang-nuts
Not very, but it does depend on the details. For example, you might provide your own http.Transport for the client to use, or even your own net.Conn. You might have the server stop sending any data, so eventually the connection will timeout. The question is, though, why would you want that? Is