Search in sources :

Example 31 with StreamingHttpRequest

use of io.servicetalk.http.api.StreamingHttpRequest in project servicetalk by apple.

the class BasicAuthHttpServiceFilterTest method emptyBasicTokenInAuthorizationHeaderForProxy.

@Test
void emptyBasicTokenInAuthorizationHeaderForProxy() throws Exception {
    StreamingHttpRequest request = reqRespFactory.get("/path");
    request.headers().set(PROXY_AUTHORIZATION, "OtherScheme qwe, Basic ");
    testProxyAuthenticationRequired(request);
}
Also used : StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Test(org.junit.jupiter.api.Test)

Example 32 with StreamingHttpRequest

use of io.servicetalk.http.api.StreamingHttpRequest in project servicetalk by apple.

the class BasicAuthHttpServiceFilterTest method wrongPassword.

@Test
void wrongPassword() throws Exception {
    StreamingHttpRequest request = reqRespFactory.get("/path");
    request.headers().set(AUTHORIZATION, "Basic " + base64("userId:wrong-password"));
    testUnauthorized(request);
}
Also used : StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Test(org.junit.jupiter.api.Test)

Example 33 with StreamingHttpRequest

use of io.servicetalk.http.api.StreamingHttpRequest in project servicetalk by apple.

the class BasicAuthHttpServiceFilterTest method authenticatedAndHasOtherScheme.

@Test
void authenticatedAndHasOtherScheme() throws Exception {
    StreamingHttpRequest request = reqRespFactory.get("/path");
    request.headers().set(AUTHORIZATION, "Other token, Basic " + base64("userId:password"));
    testAuthenticated(request);
}
Also used : StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Test(org.junit.jupiter.api.Test)

Example 34 with StreamingHttpRequest

use of io.servicetalk.http.api.StreamingHttpRequest in project servicetalk by apple.

the class EnforceSequentialModeRequesterFilterTest method responseCompletesAfterRequestPayloadBodyCompletes.

@Test
void responseCompletesAfterRequestPayloadBodyCompletes() {
    TestPublisher<Buffer> payloadBody = new TestPublisher<>();
    StreamingHttpRequest request = REQ_RES_FACTORY.post("/").payloadBody(payloadBody);
    FilterableStreamingHttpClient client = EnforceSequentialModeRequesterFilter.INSTANCE.create(this.client);
    StepVerifiers.create(client.request(request)).expectCancellable().then(payloadBody::onComplete).expectSuccess().verify();
}
Also used : Buffer(io.servicetalk.buffer.api.Buffer) TestPublisher(io.servicetalk.concurrent.api.TestPublisher) FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Test(org.junit.jupiter.api.Test)

Example 35 with StreamingHttpRequest

use of io.servicetalk.http.api.StreamingHttpRequest in project servicetalk by apple.

the class EnforceSequentialModeRequesterFilterTest method withoutFilterResponseCompletesIndependently.

@Test
void withoutFilterResponseCompletesIndependently() {
    StreamingHttpRequest request = REQ_RES_FACTORY.post("/").payloadBody(never());
    StepVerifiers.create(this.client.request(request)).expectCancellable().expectSuccess().verify();
}
Also used : StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Test(org.junit.jupiter.api.Test)

Aggregations

StreamingHttpRequest (io.servicetalk.http.api.StreamingHttpRequest)169 StreamingHttpResponse (io.servicetalk.http.api.StreamingHttpResponse)84 Test (org.junit.jupiter.api.Test)82 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)66 MethodSource (org.junit.jupiter.params.provider.MethodSource)47 Single (io.servicetalk.concurrent.api.Single)35 Buffer (io.servicetalk.buffer.api.Buffer)33 StreamingHttpClient (io.servicetalk.http.api.StreamingHttpClient)32 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)25 HttpServiceContext (io.servicetalk.http.api.HttpServiceContext)23 StreamingHttpResponseFactory (io.servicetalk.http.api.StreamingHttpResponseFactory)23 Nullable (javax.annotation.Nullable)22 InetSocketAddress (java.net.InetSocketAddress)21 OK (io.servicetalk.http.api.HttpResponseStatus.OK)20 StreamingHttpServiceFilter (io.servicetalk.http.api.StreamingHttpServiceFilter)19 CountDownLatch (java.util.concurrent.CountDownLatch)19 Single.succeeded (io.servicetalk.concurrent.api.Single.succeeded)18 HttpHeaders (io.servicetalk.http.api.HttpHeaders)17 ServerContext (io.servicetalk.transport.api.ServerContext)17 AddressUtils.localAddress (io.servicetalk.transport.netty.internal.AddressUtils.localAddress)17