func respToMap()

in lib/http.go [711:744]


func respToMap(resp *http.Response, max int64) (map[string]interface{}, error) {
	rm := map[string]interface{}{
		"Status":        resp.Status,
		"StatusCode":    resp.StatusCode,
		"Proto":         resp.Proto,
		"ProtoMajor":    resp.ProtoMajor,
		"ProtoMinor":    resp.ProtoMinor,
		"Header":        resp.Header,
		"ContentLength": resp.ContentLength,
		"Close":         resp.Close,
		"Uncompressed":  resp.Uncompressed,
	}
	var buf bytes.Buffer
	_, err := io.Copy(&buf, limitBody(resp.Body, max))
	resp.Body.Close()
	if err != nil {
		return nil, err
	}
	rm["Body"] = buf.Bytes()
	if resp.TransferEncoding != nil {
		rm["TransferEncoding"] = resp.TransferEncoding
	}
	if resp.Trailer != nil {
		rm["Trailer"] = resp.Trailer
	}
	if resp.Request != nil {
		req, err := reqToMap(resp.Request, types.String(resp.Request.URL.String()), nil, max)
		if err != nil {
			return nil, err
		}
		rm["Request"] = req
	}
	return rm, nil
}