Skip to content

Instantly share code, notes, and snippets.

@christopherhesse
Created November 20, 2014 02:54
Show Gist options
  • Save christopherhesse/a95e5aea571ca3680392 to your computer and use it in GitHub Desktop.
Save christopherhesse/a95e5aea571ca3680392 to your computer and use it in GitHub Desktop.
local
package main
import (
"bytes"
"encoding/gob"
"fmt"
"net/http"
)
func init() {
gob.Register(Object{})
http.HandleFunc("/", handler)
}
type Object struct {
String string
}
func handler(w http.ResponseWriter, r *http.Request) {
buf := &bytes.Buffer{}
args := []interface{}{Object{}}
gob.NewEncoder(buf).Encode(args)
fmt.Printf("payload=%s\n", buf.Bytes())
}
func main() {
http.ListenAndServe(":8001", nil)
}
@christopherhesse
Copy link
Author

payload=
????/??
main.Object??Object??String
??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment