public static DownstreamBuilder To(this UpstreamBuilder builder, string downstreamPath) { return(builder.To(context => { return new StringVariableReplacer().Format(downstreamPath, context.Variables); })); }
public override async Task InitializeAsync() { _upstreamServer = UpstreamBuilder .UseKestrel() .UseUrls("http://*:0") .Build(); await _upstreamServer.StartAsync(); var port = _upstreamServer.GetServerPort(); _proxyServer = ProxyBuilder .UseKestrel() .UseUrls("http://*:0") .UseSetting("port", port.ToString()) .ConfigureTestServices(services => { services .AddProxy(httpClientBuilder => httpClientBuilder .ConfigureHttpClient(client => client.Timeout = TimeSpan.FromSeconds(1))); }) .Build(); await _proxyServer.StartAsync(); }