-
-
Notifications
You must be signed in to change notification settings - Fork 389
Add Regex skipPath/skipDomain to Builder, fixes #1236 #1242
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
Conversation
executeRequestForPath(client, "/", "Response from /") | ||
val transaction = chuckerInterceptorWithoutSkipping.expectTransaction() | ||
assertThat(transaction.responseBody).isEqualTo("Response from /") | ||
chuckerInterceptorWithoutSkipping.expectNoTransactions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added chuckerInterceptorWithoutSkipping.expectNoTransactions()
to ensure false positive checks.
library/src/test/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptorTest.kt
Show resolved
Hide resolved
library/src/test/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptorTest.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me @VenomVendor 👍
Thanks for adding this. I've left some comments on the API but we can merge it just after it
* ".*path/ends/with/dev$".toRegex(), | ||
* ``` | ||
*/ | ||
public fun skipPaths(vararg skipPaths: Regex): Builder = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be a vararg, it can just be a single Regex
* ".*.dev$".toRegex(), | ||
* ``` | ||
*/ | ||
public fun skipDomain(vararg skipDomain: Regex): Builder = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add this, we'll have to add also skipDomain(vararg skipDomain: String)
Also here please remove the vararg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vararg to be removed.
Should we have both string and regex or deprecate string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have both 👍 they're so simple no need to deprecate the Regex
library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(see API comments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add also skipDomain(vararg skipDomain: String)
👍 and then we can merge this
📷 Screenshots
When
.skipPaths(".*(jpg|jpeg|png|gif|webp|svg|bmp|ico)$".toRegex())
is setfilter-image.mp4
When
.skipDomain(".*akamai.com".toRegex(), "httpbin.org".toRegex())
is setfilter-domain.mp4
📄 Context
Fixes #1236
📝 Changes
skipPath(...Regex)
skipDomain(...Regex)
🛠️ How to test
Check commmit eaff3e1, and uncomment
skipPath
and/orskipDomain
as needed.