@@ -27,18 +27,6 @@ func NewHeaderManager(req *http.Request, log logger.Logger, apiHandler APIHandle
2727 }
2828}
2929
30- // HeadersToString converts a http.Header to a string for logging,
31- // with each header on a new line for readability.
32- func HeadersToString (headers http.Header ) string {
33- var headerStrings []string
34- for name , values := range headers {
35- // Join all values for the header with a comma, as per HTTP standard
36- valueStr := strings .Join (values , ", " )
37- headerStrings = append (headerStrings , fmt .Sprintf ("%s: %s" , name , valueStr ))
38- }
39- return strings .Join (headerStrings , "\n " ) // "\n" as seperator.
40- }
41-
4230// SetAuthorization sets the Authorization header for the request.
4331func (h * HeaderManager ) SetAuthorization (token string ) {
4432 // Ensure the token is prefixed with "Bearer " only once
@@ -144,6 +132,18 @@ func (h *HeaderManager) LogHeaders(client *Client) {
144132 }
145133}
146134
135+ // HeadersToString converts a http.Header to a string for logging,
136+ // with each header on a new line for readability.
137+ func HeadersToString (headers http.Header ) string {
138+ var headerStrings []string
139+ for name , values := range headers {
140+ // Join all values for the header with a comma, as per HTTP standard
141+ valueStr := strings .Join (values , ", " )
142+ headerStrings = append (headerStrings , fmt .Sprintf ("%s: %s" , name , valueStr ))
143+ }
144+ return strings .Join (headerStrings , "\n " ) // "\n" as seperator.
145+ }
146+
147147// CheckDeprecationHeader checks the response headers for the Deprecation header and logs a warning if present.
148148func CheckDeprecationHeader (resp * http.Response , log logger.Logger ) {
149149 deprecationHeader := resp .Header .Get ("Deprecation" )
0 commit comments