receiving binary data with goweb

34 views
Skip to first unread message

Christopher Hobbs

unread,
Jul 29, 2012, 10:51:38 PM7/29/12
to golang...@googlegroups.com
I realize that this is very likely a more generic Go question, but I figured any general responses would just be "net/http" examples.

I'm using goweb in an API project and I'd like to be able to receive binary data (zip files, in this case) with my application. Does anyone have examples of this in goweb or can you shed some light on the best way to go about it?

Thank you!

Christopher Hobbs

unread,
Aug 1, 2012, 10:00:39 PM8/1/12
to golang...@googlegroups.com
In case anyone comes across this, I managed to solve the issue just by realizing that the Request field of the Context struct is just a Request struct from net/http.  I just rolled from there.  I can post sample code if necessary, but once I figured that out, it was pretty straightforward.

matryer

unread,
Aug 2, 2012, 5:36:46 PM8/2/12
to golang...@googlegroups.com
Christopher,

Do you think adding some helpers to the Context would be helpful here?  Or should Goweb focus on what it does best and leave the rest to the devs?

Mat

Christopher M. Hobbs

unread,
Aug 2, 2012, 11:16:23 PM8/2/12
to golang...@googlegroups.com
I think clearer documentation stating that cx.Request is simply a net/http
Request struct would work just fine. I like the simplicity/minimalism
of goweb as it stands. It gets rid of a lot of boilerplate for me and
then gets out of the way. I don't think additional helpers are
necessary.

I'd be happy to post some sample code for the documentation if you
think it's a good idea.

--
Christopher M. Hobbs
http://altbit.org

Tyler

unread,
Aug 2, 2012, 11:22:31 PM8/2/12
to golang...@googlegroups.com
I agree with Christopher. Goweb should remain focused on what it is for.

Clearer documentation is all that is required.

Sent from my iPhone

Tyler

unread,
Aug 2, 2012, 11:24:12 PM8/2/12
to golang...@googlegroups.com
In addition, perhaps an example in the documentation on how to receive and process binary data would be beneficial.

Sent from my iPhone

On Aug 2, 2012, at 9:16 PM, "Christopher M. Hobbs" <ch...@altbit.org> wrote:

Christopher M. Hobbs

unread,
Aug 3, 2012, 12:25:52 AM8/3/12
to golang...@googlegroups.com
Here is a generic use case for multipart form uploads with an example
of how to get values as well:

https://gist.github.com/3244341

Hope that's useful.

--
Christopher M. Hobbs
http://altbit.org

Reply all
Reply to author
Forward
0 new messages