package http import ( "encoding/json" "encoding/xml" "net/http" ) // Message HTTP response type Message struct { StatusCode int Body []byte Header http.Header } // JSON Body to JSON func (m Message) JSON(v interface{}) error { return json.Unmarshal(m.Body, v) } // XML Body to XML func (m Message) XML(v interface{}) error { return xml.Unmarshal(m.Body, v) }