func (r *Response) AssertUnmarshalledBody(data interface{}) {
	restore := r.assert.IncrCallstackOffset()
	defer restore()
	contentType, ok := r.Header[HeaderContentType]
	r.assert.True(ok)
	switch contentType {
	case ApplicationGOB:
		body := bytes.NewBuffer(r.Body)
		dec := gob.NewDecoder(body)
		err := dec.Decode(data)
		r.assert.Nil(err, "cannot decode GOB body")
	case ApplicationJSON:
		err := json.Unmarshal(r.Body, data)
		r.assert.Nil(err, "cannot unmarshal JSON body")
	case ApplicationXML:
		err := xml.Unmarshal(r.Body, data)
		r.assert.Nil(err, "cannot unmarshal XML body")
	default:
		r.assert.Fail("unknown content type: " + contentType)
	}
}
// AssertUnmarshalledBody retrieves the body based on the content type
// and unmarshals it accordingly.
AssertUnmarshalledBody retrieves the body based on the content type
and unmarshals it accordingly.
// AssertUnmarshalledBody retrieves the body based on the content type // and unmarshals it accordingly .
func (r *Response) AssertUnmarshalledBody(data interface{}) {
	restore := r.assert.IncrCallstackOffset()
	defer restore()
	contentType, ok := r.Header[HeaderContentType]
	r.assert.True(ok)
	switch contentType {
	case ApplicationGOB:
		body := bytes.NewBuffer(r.Body)
		dec := gob.NewDecoder(body)
		err := dec.Decode(data)
		r.assert.Nil(err, "cannot decode GOB body")
	case ApplicationJSON:
		err := json.Unmarshal(r.Body, data)
		r.assert.Nil(err, "cannot unmarshal JSON body")
	case ApplicationXML:
		err := xml.Unmarshal(r.Body, data)
		r.assert.Nil(err, "cannot unmarshal XML body")
	default:
		r.assert.Fail("unknown content type: " + contentType)
	}
}
func ( r * Response ) AssertUnmarshalledBody ( data interface { } ) { restore := r . assert . IncrCallstackOffset ( ) defer restore ( ) contentType , ok := r . Header [ HeaderContentType ] r . assert . True ( ok ) switch contentType { case ApplicationGOB : body := bytes . NewBuffer ( r . Body ) dec := gob . NewDecoder ( body ) err := dec . Decode ( data ) r . assert . Nil ( err , " " ) case ApplicationJSON : err := json . Unmarshal ( r . Body , data ) r . assert . Nil ( err , " " ) case ApplicationXML : err := xml . Unmarshal ( r . Body , data ) r . assert . Nil ( err , " " ) default : r . assert . Fail ( " " + contentType ) } }
AssertUnmarshalledBody retrieves the body based on the content type
and unmarshals it accordingly.
AssertUnmarshalledBody retrieves the body based on the content type and unmarshals it accordingly .