@@ -19,70 +19,3 @@ func CheckDeprecationHeader(resp *http.Response, log logger.Logger) {
1919 )
2020 }
2121}
22-
23- // TODO review the need for headers below. Do they need to be in the Integration?
24-
25- // SetCacheControlHeader sets the Cache-Control header for an HTTP request.
26- // This header specifies directives for caching mechanisms in requests and responses.
27- // func SetCacheControlHeader(req *http.Request, cacheControlValue string) {
28- // req.Header.Set("Cache-Control", cacheControlValue)
29- // }
30-
31- // SetConditionalHeaders sets the If-Modified-Since and If-None-Match headers for an HTTP request.
32- // These headers make a request conditional to ask the server to return content only if it has changed.
33- // func SetConditionalHeaders(req *http.Request, ifModifiedSince, ifNoneMatch string) {
34- // if ifModifiedSince != "" {
35- // req.Header.Set("If-Modified-Since", ifModifiedSince)
36- // }
37- // if ifNoneMatch != "" {
38- // req.Header.Set("If-None-Match", ifNoneMatch)
39- // }
40- // }
41-
42- // SetAcceptEncodingHeader sets the Accept-Encoding header for an HTTP request.
43- // This header indicates the type of encoding (e.g., gzip) the client can handle.
44- // func SetAcceptEncodingHeader(req *http.Request, acceptEncodingValue string) {
45- // req.Header.Set("Accept-Encoding", acceptEncodingValue)
46- // }
47-
48- // SetRefererHeader sets the Referer header for an HTTP request.
49- // This header indicates the address of the previous web page from which a link was followed.
50- // func SetRefererHeader(req *http.Request, refererValue string) {
51- // req.Header.Set("Referer", refererValue)
52- // }
53-
54- // SetXForwardedForHeader sets the X-Forwarded-For header for an HTTP request.
55- // This header is used to identify the originating IP address of a client connecting through a proxy.
56- // func SetXForwardedForHeader(req *http.Request, xForwardedForValue string) {
57- // req.Header.Set("X-Forwarded-For", xForwardedForValue)
58- // }
59-
60- // LogHeaders prints all the current headers in the http.Request using the zap logger.
61- // It uses the RedactSensitiveHeaderData function to redact sensitive data based on the hideSensitiveData flag.
62- // func (c *Client) LogHeaders(req *http.Request, hideSensitiveData bool) {
63- // if c.Logger.GetLogLevel() <= logger.LogLevelDebug {
64- // redactedHeaders := http.Header{}
65-
66- // for name, values := range req.Header {
67- // if len(values) > 0 {
68- // redactedValue := redact.RedactSensitiveHeaderData(hideSensitiveData, name, values[0])
69- // redactedHeaders.Set(name, redactedValue)
70- // }
71- // }
72-
73- // headersStr := HeadersToString(redactedHeaders)
74-
75- // c.Logger.Debug("HTTP Request Headers", zap.String("Headers", headersStr))
76- // }
77- // }
78-
79- // HeadersToString converts a http.Header to a string for logging,
80- // with each header on a new line for readability.
81- // func HeadersToString(headers http.Header) string {
82- // var headerStrings []string
83- // for name, values := range headers {
84- // valueStr := strings.Join(values, ", ")
85- // headerStrings = append(headerStrings, fmt.Sprintf("%s: %s", name, valueStr))
86- // }
87- // return strings.Join(headerStrings, "\n") // "\n" as seperator.
88- // }
0 commit comments