Skip to content

Instantly share code, notes, and snippets.

@nickretallack
Last active August 29, 2015 14:10
Show Gist options
  • Save nickretallack/fb7962cf22cd658bda85 to your computer and use it in GitHub Desktop.
Save nickretallack/fb7962cf22cd658bda85 to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"code.google.com/p/gogoprotobuf/proto"
"path/to/protobufs"
"io/ioutil"
)
func read_protobuf(request *http.Request) *protobufs.MyMessage {
body, err := ioutil.ReadAll(request.Body)
if err != nil {
panic(err)
}
message := new(protobufs.MyMessage)
proto.Unmarshal(body, message)
return message
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment