-
Notifications
You must be signed in to change notification settings - Fork 67
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
fix: Various fixes to make http-recorder usable again. #2983
Conversation
This reverts commit 05420e4.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2983 +/- ##
==========================================
- Coverage 82.85% 82.81% -0.04%
==========================================
Files 348 348
Lines 14591 14604 +13
Branches 2382 2381 -1
==========================================
+ Hits 12089 12095 +6
- Misses 2502 2509 +7
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -22,8 +22,31 @@ import wvlet.log.LogSupport | |||
* @param endpoint | |||
*/ | |||
class RedirectToRxEndpoint(endpoint: RxHttpEndpoint) extends LogSupport { |
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.
@xerial Any potential side-effects? Any probability something would be relying on the method name or the fact that it only has a GET endpoint?
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 one is added only for providing an adapter for http-recorder, so this fix is ok. Thanks
@@ -141,7 +142,7 @@ object HttpMessage { | |||
def nonEmpty: Boolean = !isEmpty | |||
def toContentString: String | |||
def toContentBytes: Array[Byte] | |||
def contentHash: Int = toContentBytes.hashCode() |
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.
😮 Nice catch
As it stands, http-recorder only works with GET requests without a body. This situation is caused by two issues:
Arrays.hashcode
should be used to compute an hash code over the content of the array as thehashcode
method on the array itself only relies on the address of the object.RedirectToRxEndpoint
only exposes aGET
endpoint. No other verbs can pass-through. I don't know if there's a better way to fix it, but the quick fix I'm proposing works.