WireMock.Net icon indicating copy to clipboard operation
WireMock.Net copied to clipboard

Is it possible to start a WireMockServer with http and https without specifying a port?

Open zidad opened this issue 3 years ago • 3 comments

This only starts 1 the HTTPS url: var server1 = WireMockServer.Start(port: null, ssl: true); And this requires me to specify ports:

var server2 = WireMockServer.Start(new WireMockServerSettings
{
    Urls = new[] { "http://localhost:9091", "https://localhost:9443" }
});

so something like this?

var server2 = WireMockServer.Start(new WireMockServerSettings
{
    Urls = new[] { "http://localhost:null", "https://localhost:null" }
});

zidad avatar Sep 19 '22 13:09 zidad

@zidad This is not yet possible, I'll look into this.

StefH avatar Sep 21 '22 12:09 StefH

Much appreciated!

zidad avatar Sep 21 '22 12:09 zidad

@zidad You can try preview version 1.5.6-ci-16455 (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)

And use it like:

var httpAndHttpsFree = WireMockServer.Start(new WireMockServerSettings
{
  HostingProtocol = HostingProtocol.HttpAndHttps,
});

StefH avatar Sep 21 '22 13:09 StefH

@zidad, did you have time to test this?

StefH avatar Sep 26 '22 11:09 StefH

Hi @StefH, testing it as you typed this comment :)... just a sec

zidad avatar Sep 26 '22 11:09 zidad

@StefH it works for me, many thanks!

zidad avatar Sep 26 '22 12:09 zidad

Thanks for testing.

I'll merge this PR.

Note that in the final version, the enum will be named HostingScheme/

StefH avatar Sep 26 '22 12:09 StefH

https://github.com/WireMock-Net/WireMock.Net/pull/818

StefH avatar Sep 26 '22 12:09 StefH