On Fri, May 9, 2014 at 5:57 PM, Sam Ghods wrote:
The only way to send a POST body using the http package seems to be by
assigning an io.ReadCloser to a new http.Request object. I could implement a
ReadCloser that reads data off the file upload stream and feeds it to the
http client (or better yet, pass the original file upload Request.Body
directly into the new Request), but this doesn't work as well when I want to
duplicate the stream to multiple file servers with throttling and monitoring
of the transfers.
The only way to send a POST body using the http package seems to be by
assigning an io.ReadCloser to a new http.Request object. I could implement a
ReadCloser that reads data off the file upload stream and feeds it to the
http client (or better yet, pass the original file upload Request.Body
directly into the new Request), but this doesn't work as well when I want to
duplicate the stream to multiple file servers with throttling and monitoring
of the transfers.
http://golang.org/pkg/io/#Pipe
Write() to one end of the pipe and give the other end of the pipe to
the http.Request.
If you need to write to many of these you can put the write end of the pipe in a
http://golang.org/pkg/io/#MultiWriter
and write to that.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.