示例#1
0
        public static ITunnelBuilder UseNGrok(this ITunnelBuilder builder,
                                              string tunnelApiUrl = "http://localhost:4040/api/tunnels")
        {
            var nswagTunnelRootUrl = string.Empty;

            using (var nswagApiClient = new HttpClient())
            {
                var json = nswagApiClient.GetStringAsync(tunnelApiUrl).Result;
                var ngrokTunnelResponse = JsonSerializer.Deserialize <NGrokTunnelApiResponse>(json);
                var tunnel = ngrokTunnelResponse.Tunnels.FirstOrDefault(x => x.Protocol == "https")
                             ?? ngrokTunnelResponse.Tunnels.First();

                builder.WithRootUrl(tunnel.PublicUrl);
            }

            return(builder);
        }
 public ITunnelBuilder WithRootUrl(string rootUrl)
 {
     return(_tunnelBuilder.WithRootUrl(rootUrl));
 }