use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldFilterHttpMessageWithNonTextResponse.
@Test
void shouldFilterHttpMessageWithNonTextResponse() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createDefaultRequest();
httpMessage.setResponseHeader("HTTP/1.1 200 OK\r\nContent-Type: application/x-binary\r\n");
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(true)));
assertThat(filterResult.getReason(), is(equalTo(FILTERED_REASON_NOT_TEXT)));
}
use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldFilterHttpMessageWithEmptyRequestHeader.
@Test
void shouldFilterHttpMessageWithEmptyRequestHeader() {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = new HttpMessage();
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(true)));
assertThat(filterResult.getReason(), is(equalTo(FILTERED_REASON_EMPTY)));
}
use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithSitemapXmlRequestEvenWithContentType.
@Test
void shouldNotFilterHttpMessageWithSitemapXmlRequestEvenWithContentType() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createHttpMessageWithRequestUri("/sitemap.xml");
httpMessage.getResponseHeader().setHeader(HttpHeader.CONTENT_TYPE, "application/xml");
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(false)));
}
use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldFilterHttpMessageWithEmptyResponseHeader.
@Test
void shouldFilterHttpMessageWithEmptyResponseHeader() {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createDefaultRequest();
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(true)));
assertThat(filterResult.getReason(), is(equalTo(FILTERED_REASON_EMPTY)));
}
use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithSvnXmlRequest.
@Test
void shouldNotFilterHttpMessageWithSvnXmlRequest() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createHttpMessageWithRequestUri("/.svn/wc.db");
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(false)));
}
Aggregations