Disable redirect handling in tests
We want to write expressive HTTP tests. That means that if the server sends a redirect, we don't want the test framework to just follow it. Instead, we would want to assert if the result contains a correct redirect and execute the follow-up request ourselves. Change-Id: I90572c5a27ee89f84659f80e37028be24f7c7ab8
This commit is contained in:
parent
469a49b046
commit
858023a29e
@ -19,8 +19,10 @@ import com.google.gerrit.common.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.fluent.Executor;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
public class HttpSession {
|
||||
protected TestAccount account;
|
||||
@ -30,7 +32,8 @@ public class HttpSession {
|
||||
public HttpSession(GerritServer server, @Nullable TestAccount account) {
|
||||
this.url = CharMatcher.is('/').trimTrailingFrom(server.getUrl());
|
||||
URI uri = URI.create(url);
|
||||
this.executor = Executor.newInstance();
|
||||
HttpClient noRedirectClient = HttpClientBuilder.create().disableRedirectHandling().build();
|
||||
this.executor = Executor.newInstance(noRedirectClient);
|
||||
this.account = account;
|
||||
if (account != null) {
|
||||
executor.auth(
|
||||
|
Loading…
Reference in New Issue
Block a user