func reqToMap()

in lib/http.go [677:709]


func reqToMap(req *http.Request, url, body ref.Val, max int64) (map[string]interface{}, error) {
	rm := map[string]interface{}{
		"Method":        req.Method,
		"URL":           url,
		"Proto":         req.Proto,
		"ProtoMajor":    req.ProtoMajor,
		"ProtoMinor":    req.ProtoMinor,
		"Header":        req.Header,
		"ContentLength": req.ContentLength,
		"Close":         req.Close,
		"Host":          req.Host,
	}
	if req.RequestURI != "" {
		rm["RequestURI"] = req.RequestURI
	}
	if body != nil {
		rm["Body"] = body
	}
	if req.TransferEncoding != nil {
		rm["TransferEncoding"] = req.TransferEncoding
	}
	if req.Trailer != nil {
		rm["Trailer"] = req.Trailer
	}
	if req.Response != nil {
		resp, err := respToMap(req.Response, max)
		if err != nil {
			return nil, err
		}
		rm["Response"] = resp
	}
	return rm, nil
}