1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
+ using System . Threading . Tasks ;
5
+ using WireMock . Client . Builders ;
4
6
5
7
// ReSharper disable once CheckNamespace
6
8
namespace Aspire . Hosting ;
@@ -11,7 +13,6 @@ namespace Aspire.Hosting;
11
13
public class WireMockServerArguments
12
14
{
13
15
internal const int HttpContainerPort = 80 ;
14
- internal const int HttpsContainerPort = 443 ;
15
16
16
17
/// <summary>
17
18
/// The default HTTP port where WireMock.Net is listening.
@@ -26,17 +27,6 @@ public class WireMockServerArguments
26
27
/// </summary>
27
28
public int ? HttpPort { get ; set ; }
28
29
29
- /// <summary>
30
- /// The HTTPS port where WireMock.Net is listening.
31
- /// If not defined, .NET Aspire automatically assigns a random port.
32
- /// </summary>
33
- public int ? HttpsPort { get ; set ; }
34
-
35
- /// <summary>
36
- /// Also listen on HTTPS URL.
37
- /// </summary>
38
- public bool UseHttps { get ; set ; }
39
-
40
30
/// <summary>
41
31
/// The admin username.
42
32
/// </summary>
@@ -71,6 +61,11 @@ public class WireMockServerArguments
71
61
/// </summary>
72
62
public bool HasBasicAuthentication => ! string . IsNullOrEmpty ( AdminUsername ) && ! string . IsNullOrEmpty ( AdminPassword ) ;
73
63
64
+ /// <summary>
65
+ /// Optional delegate that will be invoked to configure the WireMock.Net resource using the <see cref="AdminApiMappingBuilder"/>.
66
+ /// </summary>
67
+ public Func < AdminApiMappingBuilder , Task > ? ApiMappingBuilder { get ; set ; }
68
+
74
69
/// <summary>
75
70
/// Converts the current instance's properties to an array of command-line arguments for starting the WireMock.Net server.
76
71
/// </summary>
@@ -79,18 +74,6 @@ public string[] GetArgs()
79
74
{
80
75
var args = new Dictionary < string , string > ( ) ;
81
76
82
- Add ( args , "--Urls" , ( ) =>
83
- {
84
- var urls = $ "http://*:{ HttpContainerPort } ";
85
- if ( UseHttps || HttpsPort > 0 )
86
- {
87
- urls += $ ", https://*:{ HttpsContainerPort } ";
88
- }
89
-
90
- return urls ;
91
- }
92
- ) ;
93
-
94
77
Add ( args , "--WireMockLogger" , DefaultLogger ) ;
95
78
96
79
if ( HasBasicAuthentication )
0 commit comments