-
Notifications
You must be signed in to change notification settings - Fork 103
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
How to disable the RegEx pattern cache? #170
Comments
Hi Harry, For context: There are two caches in stubby4j: The The If there is a repeated request for the same URL and the above cache contains a stub for this URL, then this cached stub (in the code the variable's name is If the cached stub was not matched to the incoming request (even though that their URLs are equal), the incoming request is matched to all other stubs in their natural defined order. |
I tried to reproduce the issue you are experiencing in the following PR #176 (see the I made sure that the behavior of stubby4j is as expected and the test |
…caching solution will be revisited
…caching solution will be revisited
…caching solution will be revisited (#176)
Harry, I got to this sooner than I anticipated: version |
Hi Alex, |
Great, Harry. Looking forward to hear about the results and if there are any other issues |
It's tested and working well in |
Awesome! |
Harry, just for the sake of clarity I wanted to mention that in I do have a PR outstanding to bring it back #179 where I am caching stubs not just by a URI, but by the hashCode of the incoming request, but I am not going to rush to merge it in as I want to perform more testing |
Hey Alex, I noticed that there was no stub matched from caches any more during my test with |
Hi Harry, just FYI I release |
Hi Alex, I will do some text when |
It is on Maven Central now: https://search.maven.org/search?q=g:io.github.azagniotov%20AND%20a:stubby4j Have a great weekend too! |
Tested with version |
Nice! Thanks for letting me know! |
@harrysun2006 apologies for reusing this ticket, but just FYI, new feature: https://github.com/azagniotov/stubby4j#request-proxying |
Hey Alex, no need to apologise and thank you for letting me know. It's a nice new feature that will be helpful in many scenarios. |
Hey Alex,
I'm just wondering is there a way to disable the RegEx pattern cache from command line? In my project, I need to response different payloads based on the request payload (url and headers are same). So I defined a few rules (request/response) with different RegEx pattern in
post
field and I noticed that the matching is tried on rules in natural order before any such rules are cached. However, after one rule is cached, the matching will be tried on potential matched rules first, this cause some inconsistency issue.For example, I defined four rules below (pseudo code):
And then I make a few requests with different payload (matching to the regular expressions). If the payload in first request only matches to rule3, then regex3 will be cached. And in a following request, when the payload matches to both rule1 and rule3, I was expecting rule1 gets matched and response1.json is picked.
It would be great if there is a way to turn off such RegEx pattern cache. Please let me know your thoughts on it.
Thanks,
Harry
The text was updated successfully, but these errors were encountered: