func (ts *testServer) response(hr *http.Response) *Response {
	respHeader := KeyValues{}
	for key, values := range hr.Header {
		respHeader[key] = strings.Join(values, ", ")
	}
	respCookies := KeyValues{}
	for _, cookie := range hr.Cookies() {
		respCookies[cookie.Name] = cookie.Value
	}
	respBody, err := ioutil.ReadAll(hr.Body)
	ts.assert.Nil(err, "cannot read response")
	defer hr.Body.Close()
	return &Response{
		assert:  ts.assert,
		Status:  hr.StatusCode,
		Header:  respHeader,
		Cookies: respCookies,
		Body:    respBody,
	}
}
// response creates a Response instance out of the http.Response-
response creates a Response instance out of the http.Response
// response creates a Response instance out of the http . Response -
func (ts *testServer) response(hr *http.Response) *Response {
	respHeader := KeyValues{}
	for key, values := range hr.Header {
		respHeader[key] = strings.Join(values, ", ")
	}
	respCookies := KeyValues{}
	for _, cookie := range hr.Cookies() {
		respCookies[cookie.Name] = cookie.Value
	}
	respBody, err := ioutil.ReadAll(hr.Body)
	ts.assert.Nil(err, "cannot read response")
	defer hr.Body.Close()
	return &Response{
		assert:  ts.assert,
		Status:  hr.StatusCode,
		Header:  respHeader,
		Cookies: respCookies,
		Body:    respBody,
	}
}
func ( ts * testServer ) response ( hr * http . Response ) * Response { respHeader := KeyValues { } for key , values := range hr . Header { respHeader [ key ] = strings . Join ( values , " " ) } respCookies := KeyValues { } for _ , cookie := range hr . Cookies ( ) { respCookies [ cookie . Name ] = cookie . Value } respBody , err := ioutil . ReadAll ( hr . Body ) ts . assert . Nil ( err , " " ) defer hr . Body . Close ( ) return & Response { assert : ts . assert , Status : hr . StatusCode , Header : respHeader , Cookies : respCookies , Body : respBody , } }
response creates a Response instance out of the http.Response
response creates a Response instance out of the http . Response