Closed yacekmm closed 8 years ago
I ran into this issue as well. I am using 1.0.1.RELEASE for wiremock and stubruner. Is that the current version that has the fix in?
Yeah that's the one. Please double check that the proper version is used. Also try using the release train once it's out to be sure that all the versions are ok. if you still see the issue please upload a sample so that I can check it out
I tried the sample in master branch and update the contextPath to "/server" in http-server and I update the url to have "/server" in http-client. Then, I ran the tests in http-client. I got the same problem. I uploaded the sample in a zip.
The version for the tests are 1.0.2.BUILD-SNAPSHOT. dsl-sample.zip
That's disappointing. There's a test that proves that it's working. The property https://github.com/spring-cloud/spring-cloud-contract/blob/master/tests/spring-cloud-contract-stub-runner-context-path/src/main/resources/application.yml and the test https://github.com/spring-cloud/spring-cloud-contract/blob/master/tests/spring-cloud-contract-stub-runner-context-path/src/test/java/com/example/loan/LoanApplicationServiceTests.java . Can you spot the difference? I'll be able to check it out tomorrow myself
Thanks for your quick response, @marcingrzejszczak
Correct me if I am wrong, seems like the test you show me are testing the contextPath on the client.
My case is I have a contextPath set in server. Then, I make a fatJar for client test. The client can not find the correct path due to the missing contextPath on stub runner.
For example, I have a contextPath set to server as "/server", then my endpoint for "/fraudcheck" in server will be "/server/fraudcheck". I will try to hit this endpoint in my client service, for instance something like "http://localhost:8080/server/fraudcheck".
I always get an error says no matching for "/server/fraudcheck" and the closet endpoint is "/fraudcheck".
Let me know anything is not clear or I misunderstand something. Thanks
Ah so you're saying that the stubs are created with an improper URL. In that case we need a new issue right? Can you file it please?
Sure, I misunderstand this case. I will create a new issue. Thanks
When the client side, that is starting stubs from contract has the
server.context-path
property specified in itsapplication.yml
config file, then the WireMock fails to start. The problem occurs on adding a stub definitions to WireMock byPOST http://localhost:8080/__admin/mappings/new
since the WireMock url does not take thecontext-path
into account.Steps to reproduce:
server.context-path
inspring-cloud-contract\samples\standalone\dsl\http-client\src\main\resources\application.yml
:The result is:
due to ignoring the
context-path
.Is there any way to setup the context path in wiremock to fix this issue?