123456789101112131415161718192021222324 |
- package xhttp
- 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)
- }
|