use of io.servicetalk.http.api.RedirectConfig in project servicetalk by apple.
the class RedirectingHttpRequesterFilterTest method overrideAllowedMethods.
@Test
void overrideAllowedMethods() throws Exception {
RedirectConfig config = new RedirectConfigBuilder().allowedMethods(POST).build();
testRedirected(POST, MOVED_PERMANENTLY, config);
testNoRedirectWasDone(GET, MOVED_PERMANENTLY, config);
testNoRedirectWasDone(HEAD, MOVED_PERMANENTLY, config);
}
use of io.servicetalk.http.api.RedirectConfig in project servicetalk by apple.
the class RedirectingHttpRequesterFilterTest method newClient.
private StreamingHttpClient newClient(RedirectConfig config, StreamingHttpClientFilterFactory... other) {
StreamingHttpClientFilterFactory result = new RedirectingHttpRequesterFilter(config);
for (StreamingHttpClientFilterFactory next : other) {
result = appendClientFilterFactory(result, next);
}
StreamingHttpClientFilterFactory mockResponse = client -> new StreamingHttpClientFilter(client) {
@Override
protected Single<StreamingHttpResponse> request(final StreamingHttpRequester delegate, final StreamingHttpRequest request) {
return httpClient.request(request);
}
};
return from(reqRespFactory, mock(HttpExecutionContext.class), appendClientFilterFactory(result, mockResponse));
}
Aggregations