-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Add skipPaths
to selectively skip requests from Chucker
#970
Conversation
I'd like to test this out @ArjanSM on the sample app but I've just noticed it instacrash due to a StrictMode violation :| |
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.
Thanks for sending this over @ArjanSM
I don't think we want to evolve the API in this direction as this will expose the Request
object from OkHTTP to the user.
A user can manipulate the request (i.e. Read the body) in way we cannot prevent.
I think the right way to approach this feature is either:
- Provide a list of paths to use for the skip (a
List<String>
) - Provide a list of header to strip and use for the skip (again a
List<String>
)
library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt
Outdated
Show resolved
Hide resolved
- adds example in sample app. - adds tests
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.
I think the new approach goes in the right direction 👍
Left a couple of comments.
The CI is still red though, can you look into it @ArjanSM
library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt
Outdated
Show resolved
Hide resolved
sample and tests updated accordingly.
library/src/test/kotlin/com/chuckerteam/chucker/util/ChuckerInterceptorDelegate.kt
Outdated
Show resolved
Hide resolved
library/src/test/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptorTest.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/api/ChuckerInterceptor.kt
Outdated
Show resolved
Hide resolved
skipPaths
to selectively skip requests from Chucker
return if(shouldProcessTheRequest) | ||
responseProcessor.process(response,transaction) | ||
else response |
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.
Let's merge it as it is, but I believe KtLint is broken here as this is not properly formatted
📄 Context
Fixes #266
📝 Changes
I added a public API,
skipPaths(paths:List<String>)
, to theChuckerInterceptor.Builer
.The ChuckerInterceptor decides to process the transaction based on the outcome of the lambda in
skipEndpoints
.🚫 Breaking
Adding
skipPaths(..)
to theChuckerInterceptor.Build
will be a breaking change.🛠️ How to test
ChuckerInterceptorTest
/anything
to the HttpBinHttpTask.kt and added/anything
to the skip paths list in the sample app.