Search in sources :

Example 21 with Response

use of okhttp3.Response in project sonarqube by SonarSource.

the class HttpHeadersTest method assertNoCacheInBrowser.

private static void assertNoCacheInBrowser(Response httpResponse) {
    CacheControl cacheControl = httpResponse.cacheControl();
    assertThat(cacheControl.mustRevalidate()).isTrue();
    assertThat(cacheControl.noCache()).isTrue();
    assertThat(cacheControl.noStore()).isTrue();
}
Also used : CacheControl(okhttp3.CacheControl)

Example 22 with Response

use of okhttp3.Response in project sonarqube by SonarSource.

the class CeHttpServerTest method return_http_response_with_code_404_and_exception_message_as_body_when_url_has_no_matching_action.

@Test
public void return_http_response_with_code_404_and_exception_message_as_body_when_url_has_no_matching_action() throws IOException {
    String action = "/dfdsfdsfsdsd";
    Response response = call(underTest.getUrl() + action);
    assertThat(response.code()).isEqualTo(404);
    assertThat(response.body().string()).isEqualTo("Error 404, '" + action + "' not found.");
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 23 with Response

use of okhttp3.Response in project sonarqube by SonarSource.

the class CeHttpServerTest method action_is_matched_on_URL_ignoring_case.

@Test
public void action_is_matched_on_URL_ignoring_case() throws IOException {
    Response response = call(underTest.getUrl() + "/pOMpoM");
    assertIsPomPomResponse(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 24 with Response

use of okhttp3.Response in project sonarqube by SonarSource.

the class CeHttpServerTest method action_is_matched_on_URL_with_parameters.

@Test
public void action_is_matched_on_URL_with_parameters() throws IOException {
    Response response = call(underTest.getUrl() + "/pompom?toto=2");
    assertIsPomPomResponse(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 25 with Response

use of okhttp3.Response in project sonarqube by SonarSource.

the class CeHttpServerTest method action_is_matched_on_exact_URL.

@Test
public void action_is_matched_on_exact_URL() throws IOException {
    Response response = call(underTest.getUrl() + "/pompom");
    assertIsPomPomResponse(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)471 Response (okhttp3.Response)444 MockResponse (okhttp3.mockwebserver.MockResponse)380 Request (okhttp3.Request)377 ResponseBody (okhttp3.ResponseBody)351 IOException (java.io.IOException)220 DateTime (org.joda.time.DateTime)194 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)192 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)178 Response (retrofit2.Response)150 ServiceCall (com.microsoft.rest.ServiceCall)140 ServiceResponse (com.microsoft.rest.ServiceResponse)114 Observable (rx.Observable)104 Call (okhttp3.Call)103 List (java.util.List)95 RequestBody (okhttp3.RequestBody)85 PagedList (com.microsoft.azure.PagedList)80 ServiceResponseWithHeaders (com.microsoft.rest.ServiceResponseWithHeaders)78 OkHttpClient (okhttp3.OkHttpClient)78 HttpURLConnection (java.net.HttpURLConnection)47