WebTestClientHtmlUnitDriverBuilder uses WebTestClient for localhost
Fixes gh-4815
This commit is contained in:
parent
426c034c01
commit
3c7fb977fe
|
@ -17,8 +17,12 @@
|
|||
package org.springframework.security.htmlunit.server;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.WebConnection;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection;
|
||||
import org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection.DelegateWebConnection;
|
||||
import org.springframework.test.web.servlet.htmlunit.HostRequestMatcher;
|
||||
import org.springframework.test.web.servlet.htmlunit.webdriver.WebConnectionHtmlUnitDriver;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +39,8 @@ public class WebTestClientHtmlUnitDriverBuilder {
|
|||
public WebDriver build() {
|
||||
WebConnectionHtmlUnitDriver driver = new WebConnectionHtmlUnitDriver();
|
||||
WebClient webClient = driver.getWebClient();
|
||||
WebTestClientWebConnection connection = new WebTestClientWebConnection(this.webTestClient, webClient);
|
||||
WebTestClientWebConnection webClientConnection = new WebTestClientWebConnection(this.webTestClient, webClient);
|
||||
WebConnection connection = new DelegatingWebConnection(driver.getWebConnection(), new DelegateWebConnection(new HostRequestMatcher("localhost"), webClientConnection));
|
||||
driver.setWebConnection(connection);
|
||||
return driver;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue