Last active
August 29, 2015 14:10
-
-
Save nickretallack/fb7962cf22cd658bda85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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