wiremock / wiremock-spring-boot

WireMock Spring Boot drastically simplifies testing HTTP clients in Spring Boot & Junit 5 based integration tests.
MIT License
314 stars 16 forks source link

Http and https on same instance #62

Closed dogruis closed 2 weeks ago

dogruis commented 3 weeks ago

Proposal

With your 3.1.0 version I have to use @EnableWireMock{{@ConfigureWireMock(port = 8081)}, @ConfigureWireMock(useHttps = true, port = 8082)} To have http and https enabled

I would prefer to use

@EnableWireMock(@ConfigureWireMock(port = 8081, httpsPort = 8082)

This would save me from having the need to spin up two wiremock instances.

Edit: I don't know if you have access to this documentation but it need to be updated to reflect your changes. https://wiremock.org/docs/solutions/spring-boot/

References

No response

tomasbjerre commented 3 weeks ago

Do you have any suggestions for naming the properties?

dogruis commented 3 weeks ago

I think it should follow the same naming convention as the wiremock-standalone project: https://wiremock.org/docs/junit-jupiter/ port and httpsPort

Or here https://github.com/wiremock/wiremock/blob/master/src/main/java/com/github/tomakehurst/wiremock/core/WireMockConfiguration.java

tomasbjerre commented 3 weeks ago

And if you dont want to have static ports. How do you want to enable it?

dogruis commented 3 weeks ago

I guess just using httpsEnabled=true is good enough

dogruis commented 3 weeks ago

Generally I only need http or https. In some cases I want both but then I specify the static port numbers. It depends on the use case

tomasbjerre commented 3 weeks ago

Perhaps one way to solve this is to:

tomasbjerre commented 2 weeks ago

On top of that with version 3.1.0

@EnableWireMock{{@ConfigureWireMock(port = 8081)}, @ConfigureWireMock(useHttps = true, port = 8082)}

When I use this it is breaking my spring application context for some reason.

Probably because they both have the same name. But hard to be sure without your log. I submitted a PR that will give an error when same name is used. #63

tomasbjerre commented 2 weeks ago

PR available with example test case that uses HTTP and HTTPS #64

tomasbjerre commented 2 weeks ago

Also regarding the documentation on the website. I prefer that to be very minimal and refer users to the running examples here in the repository. I think running examples are trustworthy for users and easy to maintain for me.

tomasbjerre commented 2 weeks ago

Released in 3.2.0

dogruis commented 2 weeks ago

Awesome