Search in sources :

Example 11 with HttpResponseBody

use of org.zaproxy.zap.network.HttpResponseBody in project zaproxy by zaproxy.

the class HttpMessageUnitTest method shouldSetContentEncodingsWhenSettingResponseBodyByte.

@Test
void shouldSetContentEncodingsWhenSettingResponseBodyByte() {
    // Given
    HttpResponseHeader header = mock(HttpResponseHeader.class);
    given(header.getHeader(HttpHeader.CONTENT_ENCODING)).willReturn(HttpHeader.GZIP);
    HttpResponseBody body = mock(HttpResponseBody.class);
    HttpMessage message = new HttpMessage(mock(HttpRequestHeader.class), mock(HttpRequestBody.class), header, body);
    // When
    message.setResponseBody(new byte[0]);
    // Then
    assertThat(encodings(body), is(not(empty())));
}
Also used : HttpRequestBody(org.zaproxy.zap.network.HttpRequestBody) HttpResponseBody(org.zaproxy.zap.network.HttpResponseBody) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

HttpResponseBody (org.zaproxy.zap.network.HttpResponseBody)11 Test (org.junit.jupiter.api.Test)8 HttpMessage (org.parosproxy.paros.network.HttpMessage)6 HttpResponseHeader (org.parosproxy.paros.network.HttpResponseHeader)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 HttpRequestBody (org.zaproxy.zap.network.HttpRequestBody)4 BeforeEach (org.junit.jupiter.api.BeforeEach)1 HistoryReference (org.parosproxy.paros.model.HistoryReference)1 HttpSession (org.zaproxy.zap.extension.httpsessions.HttpSession)1 User (org.zaproxy.zap.users.User)1