Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit urlParams from network breadcrumbs when empty #1379

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[#1358](https://github.com/bugsnag/bugsnag-android/pull/1358)
[#1361](https://github.com/bugsnag/bugsnag-android/pull/1361)
[#1363](https://github.com/bugsnag/bugsnag-android/pull/1363)
[#1379](https://github.com/bugsnag/bugsnag-android/pull/1379)

* Update project to build using Gradle/AGP 7
[#1354](https://github.com/bugsnag/bugsnag-android/pull/1354)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ class BugsnagOkHttpPlugin @JvmOverloads constructor(
"method" to request.method,
"url" to sanitizeUrl(request),
"duration" to nowMs - info.startTime,
"urlParams" to buildQueryParams(request),
"requestContentLength" to info.requestBodyCount
)

val queryParams = buildQueryParams(request)
if (queryParams.isNotEmpty()) {
data["urlParams"] = queryParams
}

// only add response body length + status for requests that did not error
if (result != RequestResult.ERROR) {
data["responseContentLength"] = info.responseBodyCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CachedRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(13L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url.toString(), get("url"))
}
}
Expand Down Expand Up @@ -129,7 +129,7 @@ class CachedRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(13L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url.toString(), get("url"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ComplexRequestIntegrationTest {
assertEquals("GET", get("method"))
assertEquals(0L, get("requestContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
assertNull(get("status"))
assertNull(get("responseContentLength"))
Expand All @@ -89,7 +89,7 @@ class ComplexRequestIntegrationTest {
assertEquals("GET", get("method"))
assertEquals(0L, get("requestContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
assertNull(get("status"))
assertNull(get("responseContentLength"))
Expand Down Expand Up @@ -132,7 +132,7 @@ class ComplexRequestIntegrationTest {
assertEquals("GET", get("method"))
assertEquals(0L, get("requestContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url.toString(), get("url"))
assertNull(get("status"))
assertNull(get("responseContentLength"))
Expand Down Expand Up @@ -172,7 +172,7 @@ class ComplexRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url.toString(), get("url"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.bugsnag.android
import okhttp3.Request
import okhttp3.mockwebserver.MockResponse
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -50,7 +51,7 @@ class GetRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -109,7 +110,7 @@ class GetRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -164,7 +165,7 @@ class GetRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import okhttp3.mockwebserver.MockResponse
import okio.Buffer
import okio.BufferedSink
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -68,7 +69,7 @@ class PostRequestIntegrationTest {
assertEquals(49L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -96,7 +97,7 @@ class PostRequestIntegrationTest {
assertEquals(11L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -133,7 +134,7 @@ class PostRequestIntegrationTest {
assertEquals(11890L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -164,7 +165,7 @@ class PostRequestIntegrationTest {
assertEquals(303L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -195,7 +196,7 @@ class PostRequestIntegrationTest {
assertEquals(49L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down Expand Up @@ -226,7 +227,7 @@ class PostRequestIntegrationTest {
assertEquals(49L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand All @@ -251,7 +252,7 @@ class PostRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(url, get("url"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import okhttp3.Request
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
Expand Down Expand Up @@ -68,7 +69,7 @@ class RedirectedRequestIntegrationTest {
assertEquals(0L, get("requestContentLength"))
assertEquals(0L, get("responseContentLength"))
assertTrue(get("duration") is Long)
assertEquals(emptyMap<String, Any>(), get("urlParams"))
assertNull(get("urlParams"))
assertEquals(server.url("/test").toString(), get("url"))
}
}
Expand Down