最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Hoverfly Proxy setting not working with Spring WebClient - Stack Overflow

programmeradmin2浏览0评论

I am trying to mock the responses using hoverfly, but it not working with webclient. Same setup works if i switch to RestTemplate for service calls and i am using following webclient configs.

@Bean
  public WebClient webClient() {
    HttpClient httpClient = HttpClient.create();

    if (proxyEnabled) {
      LOGGER.info(s("Using proxy: {}:{}"), proxyHost, proxyPort);
      httpClient = httpClient
          .proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP).host(proxyHost).port(proxyPort))
          .wiretap(true);
    }

    return WebClient.builder()
        .clientConnector(new ReactorClientHttpConnector(httpClient))
        .build();
  }
发布评论

评论列表(0)

  1. 暂无评论