Search in sources :

Example 16 with Response

use of com.ecwid.consul.v1.Response in project sonarqube by SonarSource.

the class SsoAuthenticationTest method display_message_in_ui_but_not_in_log_when_unauthorized_exception.

@Test
public void display_message_in_ui_but_not_in_log_when_unauthorized_exception() throws Exception {
    Response response = doCall("invalid login $", null, null, null);
    assertThat(response.code()).isEqualTo(200);
    assertThat(response.request().url().toString()).contains("sessions/unauthorized");
    List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getWebLogs(), UTF_8);
    assertThat(logsLines).doesNotContain("org.sonar.server.exceptions.BadRequestException: Use only letters, numbers, and .-_@ please.");
    USER_RULE.verifyUserDoesNotExist(USER_LOGIN);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 17 with Response

use of com.ecwid.consul.v1.Response in project sonarqube by SonarSource.

the class HttpHeadersTest method verify_headers_of_images.

@Test
public void verify_headers_of_images() throws Exception {
    Response response = call(orchestrator.getServer().getUrl() + "/images/logo.svg");
    verifySecurityHeaders(response);
    verifyContentType(response, "image/svg+xml");
    assertCacheInBrowser(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 18 with Response

use of com.ecwid.consul.v1.Response in project sonarqube by SonarSource.

the class HttpHeadersTest method verify_headers_of_ws.

@Test
public void verify_headers_of_ws() throws Exception {
    Response response = call(orchestrator.getServer().getUrl() + "/api/issues/search");
    verifySecurityHeaders(response);
    verifyContentType(response, "application/json");
    assertNoCacheInBrowser(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 19 with Response

use of com.ecwid.consul.v1.Response in project sonarqube by SonarSource.

the class HttpHeadersTest method verify_headers_of_css.

@Test
public void verify_headers_of_css() throws Exception {
    Response response = call(orchestrator.getServer().getUrl() + "/css/sonar." + JS_HASH + ".css");
    verifySecurityHeaders(response);
    verifyContentType(response, "text/css");
    assertCacheInBrowser(response);
}
Also used : Response(okhttp3.Response) Test(org.junit.Test)

Example 20 with Response

use of com.ecwid.consul.v1.Response in project zipkin by openzipkin.

the class AWSSignatureVersion4 method intercept.

@Override
public Response intercept(Chain chain) throws IOException {
    Request input = chain.request();
    Request signed = sign(input);
    Response response = chain.proceed(signed);
    if (response.code() == 403) {
        try (ResponseBody body = response.body()) {
            JsonReader message = enterPath(JsonReader.of(body.source()), "message");
            if (message != null)
                throw new IllegalStateException(message.nextString());
        }
        throw new IllegalStateException(response.toString());
    }
    return response;
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) JsonReader(com.squareup.moshi.JsonReader) ResponseBody(okhttp3.ResponseBody)

Aggregations

Response (okhttp3.Response)1475 Request (okhttp3.Request)1045 IOException (java.io.IOException)547 Test (org.junit.Test)438 Response (retrofit2.Response)338 Call (okhttp3.Call)293 OkHttpClient (okhttp3.OkHttpClient)287 ResponseBody (okhttp3.ResponseBody)245 ServiceResponse (com.microsoft.rest.ServiceResponse)179 RequestBody (okhttp3.RequestBody)153 MockResponse (okhttp3.mockwebserver.MockResponse)148 Callback (okhttp3.Callback)129 List (java.util.List)118 Observable (rx.Observable)114 JSONObject (org.json.JSONObject)93 ArrayList (java.util.ArrayList)90 HttpUrl (okhttp3.HttpUrl)87 ANResponse (com.androidnetworking.common.ANResponse)84 InputStream (java.io.InputStream)81 Map (java.util.Map)81