Fix finding a request; optimization of saving requests.#13
Open
kumold wants to merge 2 commits intoacsbendi:masterfrom
Open
Fix finding a request; optimization of saving requests.#13kumold wants to merge 2 commits intoacsbendi:masterfrom
kumold wants to merge 2 commits intoacsbendi:masterfrom
Conversation
Fix finding a request; optimization of saving requests.
Add method to get recorded request
acsbendi
reviewed
Oct 21, 2023
Comment on lines
23
to
25
| recordedRequests.find { recordedRequest -> | ||
| url.contains(recordedRequest.url) | ||
| url == recordedRequest.url && method == recordedRequest.method | ||
| } |
Owner
There was a problem hiding this comment.
The reason why contains was used instead of == when checking the URL match is that sometimes it fails to record the whole URL, and we want to be able to find it based on a partial match. So I suggest we keep the contains for the URL.
Comment on lines
+39
to
+50
| override fun equals(other: Any?): Boolean { | ||
| if (other !is RecordedRequest) return super.equals(other) | ||
| return url == other.url | ||
| && method == other.method | ||
| && body == other.body | ||
| && headers == other.headers | ||
| && formParameters == other.formParameters | ||
| } | ||
|
|
||
| override fun hashCode(): Int { | ||
| return super.hashCode() | ||
| } |
Owner
There was a problem hiding this comment.
I don't think these are needed, Kotlin generates equals and hashCode for data classes.
There was a problem hiding this comment.
I presume the idea is to make the two requests equal only when a subset of parameters are equal, but for example not necessarily "trace" or "enctype".
| private fun addRecordedRequest(recordedRequest: RecordedRequest) { | ||
| synchronized(recordedRequests) { | ||
| recordedRequests.add(recordedRequest) | ||
| if (!recordedRequests.equals(recordedRequest)) |
Owner
There was a problem hiding this comment.
What's the goal here? Why is it a problem if we record a request multiple times?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix finding a request; optimization of saving requests.