Skip to content

Commit

Permalink
Only log network request when getWrappedStream is called
Browse files Browse the repository at this point in the history
  • Loading branch information
bidetofevil committed Apr 19, 2024
1 parent 55dfc57 commit 6ba1f17
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ public long getHeaderFieldLong(@NonNull String name, long defaultValue) {
@Override
@Nullable
public Map<String, List<String>> getHeaderFields() {
final long startTime = embrace.getInternalInterface().getSdkCurrentTime();
cacheAndLogNetworkCall(startTime);
cacheNetworkCallData();
return headerFields.get();
}

Expand All @@ -359,14 +358,13 @@ private <R> R retrieveHeaderField(@Nullable String name,
if (name == null) {
return null;
}
long startTime = embrace.getInternalInterface().getSdkCurrentTime();
if (shouldInterceptHeaderRetrieval(name)) {
// Strip the content encoding and length headers, as we transparently ungzip the content
return defaultValue;
}

R result = action.invoke();
cacheAndLogNetworkCall(startTime);
cacheNetworkCallData();

return result;
}
Expand Down Expand Up @@ -461,18 +459,16 @@ public String getRequestProperty(@NonNull String key) {
@Override
public int getResponseCode() {
identifyTraceId();
long startTime = embrace.getInternalInterface().getSdkCurrentTime();
cacheAndLogNetworkCall(startTime);
cacheNetworkCallData();
return responseCode.get();
}

@Override
@Nullable
public String getResponseMessage() throws IOException {
identifyTraceId();
long startTime = embrace.getInternalInterface().getSdkCurrentTime();
String responseMsg = this.connection.getResponseMessage();
cacheAndLogNetworkCall(startTime);
cacheNetworkCallData();
return responseMsg;
}

Expand Down

0 comments on commit 6ba1f17

Please sign in to comment.