Skip to content
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

Include conditions in proxying functionality #2695

Open
Alan-Vlc opened this issue Apr 25, 2024 · 5 comments
Open

Include conditions in proxying functionality #2695

Alan-Vlc opened this issue Apr 25, 2024 · 5 comments

Comments

@Alan-Vlc
Copy link

Proposal

Hello,
I am testing Wiremock's proxying functionality to “route” certain http requests that arrive to my Wiremock pod to a URL. Everything works correctly using the following configuration file: {

  {
  "mappings": [
    {
      "request": {
        "urlPathPattern": "/stores/products/out-of-stock-store-lost-sales/.*"
      },
      "response": {
        "proxyBaseUrl": "https://myendpoint.testing”
        
      }
    }
  ]
}

Would it be possible to establish conditions for the proxying functionality? Some examples:

  • 50% of requests that meet "urlPathPattern" https are redirected to “proxyBaseUrl” and the remaining 50% of http requests return a 500 response code.
  • 30% of requests that match "urlPathPattern" https are redirected to “proxyBaseUrl”, another 30% of http requests return a 500 response code and the remaining 40% of http requests return a 401 response code.

I would appreciate it if you considered implementing this type of improvement in future versions.

Thanks in advance

References

No response

@tomakehurst
Copy link
Member

I don't think this is something we'd want to do in the core library, but you could implement this fairly trivially by building a ResponseTransformerV2 extension.

@Alan-Vlc
Copy link
Author

Thanks for your response.

Sorry, but I don't quite understand how to cover the need with what you indicate. I have followed the following link ( https://wiremock.org/docs/extensibility/transforming-responses/) and I don't understand how to cover the examples I have specified.
Keep in mind that I build a pod with wiremock to act as a proxy, since we do not want to put java code in the application part.

Thanks

@tomakehurst
Copy link
Member

I suggest you head over to the Slack community if you need some support creating and installing WireMock extensions.

@Alan-Vlc
Copy link
Author

@tomakehurst
Copy link
Member

No, webhooks is built into the core now, so there's no extension in more recent versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants