HTTP Post []byte

1,981 views
Skip to first unread message

ThePiachu

unread,
Nov 7, 2011, 6:32:09 PM11/7/11
to golang-nuts
I want to send []byte data over http via post on Google App Engine in
Go. How do I construct bodyType and, body for the request using the
package http?

http://golang.org/pkg/http/#Client.Post

Brad Fitzpatrick

unread,
Nov 7, 2011, 6:45:22 PM11/7/11
to ThePiachu, golang-nuts
bodyType is your Content-Type.  You can leave it blank, or "application/octet-stream", but you probably know the type of data and should set it to what the server expects.

As for the body, see:


A *bytes.Buffer implements io.Reader.
Reply all
Reply to author
Forward
0 new messages