public IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request,
                                                         IResponse response)
        {
            IResponseFilter filter = null;

            int statusCode = response.StatusCode;

            if (statusCode == 200 && request.Url.Contains("userverify"))
            {
                RecaptchaResponseFilter rFilter = new RecaptchaResponseFilter();
                rFilter.TokenFound += OnTokenFound;

                filter = rFilter;
            }

            return(filter);
        }
 public CoverageCalculator(
     ISwaggerProvider swaggerProvider,
     ISwaggerParser swaggerParser,
     IResponseLogProvider responseLogProvider,
     IResponseLogParser responseLogParser,
     IApiAnalyzerFactory analyzerFactory,
     IReportPersister reportPersister,
     IResponseFilter responseFilter)
 {
     _swaggerProvider     = swaggerProvider ?? throw new ArgumentNullException(nameof(swaggerProvider));
     _swaggerParser       = swaggerParser ?? throw new ArgumentNullException(nameof(swaggerParser));
     _responseLogProvider = responseLogProvider ?? throw new ArgumentNullException(nameof(responseLogProvider));
     _responseLogParser   = responseLogParser ?? throw new ArgumentNullException(nameof(responseLogParser));
     _analyzerFactory     = analyzerFactory ?? throw new ArgumentNullException(nameof(analyzerFactory));
     _reportPersister     = reportPersister ?? throw new ArgumentNullException(nameof(reportPersister));
     _responseFilter      = responseFilter ?? throw new ArgumentNullException(nameof(responseFilter));
 }
        public IResponseFilter GetResourceResponseFilter(
            IWebBrowser browserControl,
            IBrowser browser,
            IFrame frame,
            IRequest request,
            IResponse response)
        {
            IResponseFilter responseFilter = (IResponseFilter)null;

            if (this._handler != null)
            {
                responseFilter = this._handler.GetResourceResponseFilter(browserControl, browser, frame, request, response);
                if (responseFilter != null)
                {
                    return(responseFilter);
                }
            }
            if (request.Url.Contains("api/basket/clear"))
            {
                RequestHandlerAdapter.ExecuteScriptInMainFrameSafe(browser, "var olimpBasketCleared=true; console.log('Корзина очищена ');", "about:olimp/basket/clear");
            }
            if (request.Url.Contains("api/basket"))
            {
                ++this.olimpBasketLoaded;
                RequestHandlerAdapter.ExecuteScriptInMainFrameSafe(browser, string.Format("var olimpBasketLoaded={0}; console.log('Запрос к корзине {1} раз');", (object)this.olimpBasketLoaded, (object)this.olimpBasketLoaded), "about:olimp/basket");
            }
            if (request.Url.ToLower().Contains("app.min.js?2019"))
            {
                return((IResponseFilter) new FindReplaceResponseFilter("b.debugInfoEnabled(\"localhost\"===window.location.hostname)", ""));
            }
            lock (this._responseUrl)
            {
                string lower = request.Url.ToLower();
                foreach (string url in this._responseUrl)
                {
                    if (lower.Contains(url.ToLower()))
                    {
                        responseFilter = (IResponseFilter) new ExperimentalStreamResponseFilter(browser.MainFrame, url);
                    }
                }
            }
            return(responseFilter);
        }
Example #4
0
 public void AddResponseFilter(IResponseFilter responseFilter)
 {
     _serverContext.ResponseFilter = responseFilter;
 }
 public void AddResponseFilter(IResponseFilter responseFilter)
 {
     _serverContext.ResponseFilter = responseFilter;
 }