func setErrorHeaderContext(err error, prefix string, head http.Header) { for key, _ := range head { contextKey := fmt.Sprintf("%s:%s", prefix, key) if _, skip := hiddenHeaders[key]; skip { errors.SetContext(err, contextKey, "--") } else { errors.SetContext(err, contextKey, head.Get(key)) } } }
func setErrorRequestContext(cfg *config.Configuration, err error, req *http.Request) { errors.SetContext(err, "Endpoint", cfg.Endpoint(auth.GetOperationForRequest(req)).Url) errors.SetContext(err, "URL", TraceHttpReq(req)) setErrorHeaderContext(err, "Response", req.Header) }
func SetErrorResponseContext(cfg *config.Configuration, err error, res *http.Response) { errors.SetContext(err, "Status", res.Status) setErrorHeaderContext(err, "Request", res.Header) setErrorRequestContext(cfg, err, res.Request) }