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

Record multiple external services #299

Closed
leoluz opened this issue Sep 3, 2015 · 6 comments
Closed

Record multiple external services #299

leoluz opened this issue Sep 3, 2015 · 6 comments

Comments

@leoluz
Copy link

leoluz commented Sep 3, 2015

Hi,

First of all congratulations for this great library. Its simple to use, good documentation and more importantly: it works! :)

My issue is related with the fact that I need to record not one external service but many of them. It seems that the wiremock-standalone just has the option to setup one proxy using the --proxy-all switch. Is it possible to record with my own defined stubs? If no, is there any other to achieve this?

Thanks a lot!
Leo

@tomakehurst
Copy link
Member

Thanks!

Yes, it is possible to record against multiple targets by configuring a proxy stub mapping against each of them via the API rather than via the --proxy-all param (which actually just creates a single proxy mapping internally).

@mpAutomation
Copy link

mpAutomation commented Feb 14, 2017

hi @tomakehurst . I am also attempting to record against multiple services. However it is not clear to me how to do it. The only way I can record is against one service via --proxyAll. Could you give me an example on how to do the above please?

@aniajra
Copy link

aniajra commented Jun 25, 2018

hi @tomakehurst My API has multiple exernal API calls and i need to mock that by recording them. I am getting unauthorised error. However if i make calls to the external apis directly i am able to record them could you please help.

@stephenh
Copy link

stephenh commented Oct 2, 2018

Hi; I just used wiremock to do some load testing in docker and it worked great; FWIW being able to record multiple urls at once would be nice, e.g. in docker-compose I had a single wiremock instance, and then gave my app both SERVICE_A_URL=http://wiremock/ and SERVICE_B_URL=http://wiremock as environment variables, but it meant I had to stop/start wiremock a few times to change the proxy-all from service a, record a request, shut it down, change proxy-all to service b, record a request, shut it down.

Doing something like --proxy-host=servicea:http://service-a.company.com --proxy-host=serviceb:http://service-b.company.com and then using host headers (e.g. SERVICE_A_URL=http://servicea/ within docker-compose) would be spiffy (specifically for recording requests that touch multiple services).

Great tool; thanks!

@basterboy
Copy link

How to record against multiple targets by configuring a proxy stub mapping against each of them:

  1. Create a stub template and put it into mappings folder, example:
    { "mappings": [ { "request": { "method": "ANY", "urlPattern": "/api/.*" }, "response": { "proxyBaseUrl" : "http://example1.com" } }, { "request": { "method": "ANY", "urlPattern": "/content" }, "response": { "proxyBaseUrl" : "http://example2.com" } } ] }
  2. To record run: java -jar wiremock-standalone-2.25.1.jar --https-port 443 --https-keystore wiremock.jks --record-mappings --verbose

@educostadev
Copy link

educostadev commented Apr 28, 2023

For an exemple on how to record and replay multiple external services check this out https://github.com/educostadev/wiremock

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

No branches or pull requests

7 participants