Skip to content

Commit d20a0c9

Browse files
author
Ignacio Bonafonte
committed
Avoid duplicating requests when not injecting tracing headers
1 parent c3f08b2 commit d20a0c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Instrumentation/URLSession/URLSessionLogger.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class URLSessionLogger {
7979
}
8080

8181
var returnRequest: URLRequest?
82-
if shouldInjectHeaders {
82+
if shouldInjectHeaders && (instrumentation.configuration.shouldInjectTracingHeaders?(request) ?? true) {
8383
returnRequest = instrumentedRequest(for: request, span: span, instrumentation: instrumentation)
8484
}
8585

@@ -91,7 +91,7 @@ class URLSessionLogger {
9191

9292
instrumentation.configuration.createdRequest?(returnRequest ?? request, span)
9393

94-
return returnRequest ?? request
94+
return returnRequest
9595
}
9696

9797
/// This methods ends a Span when a response arrives

0 commit comments

Comments
 (0)