コード例 #1
0
        public DemoConfigurationSource(int responseCount, string reverseProxyUri = null)
        {
            ResponseCount       = responseCount;
            ReverseProxyOptions = new ReverseProxyOptions();

            _reverseProxyUri = reverseProxyUri ?? "http://localhost/demoreverseproxy";
        }
コード例 #2
0
ファイル: ProxyApiTo.cs プロジェクト: Bumsteer/openrasta-core
 public ProxyApiTo(string to,
                   ReverseProxyOptions options,
                   Func <ICommunicationContext, string> operation = null)
 {
     this.to        = to;
     this.options   = options;
     this.operation = operation ?? (ctx => ctx.Request.Uri.ToString());
 }
コード例 #3
0
        public PingController(IOptions <ReverseProxyOptions> proxyOptions)
        {
            if (proxyOptions?.Value == null)
            {
                throw new ArgumentNullException(nameof(proxyOptions));
            }

            _reverseProxyOptions = proxyOptions.Value;
        }
コード例 #4
0
 public ProxyApiFrom(
     string from,
     string to,
     ReverseProxyOptions options)
 {
     this.from    = from;
     this.to      = to;
     this.options = options;
 }
コード例 #5
0
        TestServer CreateToServer()
        {
            var options = new ReverseProxyOptions();

            _toOptions?.Invoke(options);
            return(_toServer = new TestServer(
                       new WebHostBuilder()
                       .Configure(app =>
            {
                app.UseOpenRasta(
                    new ProxyApiTo(
                        _to,
                        options,
                        _handler));
            })));
        }
コード例 #6
0
        TestServer CreateFromServer()
        {
            var options = new ReverseProxyOptions
            {
                HttpMessageHandler = () => _toServer.CreateHandler()
            };

            _fromOptions?.Invoke(options);

            return(new TestServer(
                       new WebHostBuilder()
                       .Configure(app =>
            {
                app.UseOpenRasta(
                    new ProxyApiFrom(_from, _to, options));
            })));
        }
        public void ShouldByDefaultContainFilter(string filterTypeName)
        {
            var proxy = new ReverseProxyOptions();

            Assert.Contains(proxy.Filters, x => x.GetType().Name == filterTypeName);
        }