File tree 2 files changed +13
-0
lines changed
src/main/java/com/easypost/easyvcr 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Next Release
4
4
5
+ - New ` byCustomRule ` function to allow users to define their own matching rule when finding a matching interaction in a cassette
5
6
- Improve error messages when a matching interaction is not found (human-readable error messages)
6
7
- Fix bug where the base URL matching rule was not comparing the scheme, host, and port of the request URL properly
7
8
Original file line number Diff line number Diff line change @@ -248,6 +248,18 @@ public MatchRules byMethod() {
248
248
return this ;
249
249
}
250
250
251
+ /**
252
+ * Add a rule to compare two requests by a custom rule.
253
+ * @param rule A BiFunction that accepts two Request instances and returns true if they match, false otherwise.
254
+ * The first parameter is the current in-flight request,
255
+ * the second parameter is the recorded request from the current cassette.
256
+ * @return This MatchRules factory.
257
+ */
258
+ public MatchRules byCustomRule (BiFunction <Request , Request , Boolean > rule ) {
259
+ by (rule );
260
+ return this ;
261
+ }
262
+
251
263
/**
252
264
* Execute rules to determine if the received request matches the recorded request.
253
265
*
You can’t perform that action at this time.
0 commit comments