use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithSvnDbRequest.
@Test
void shouldNotFilterHttpMessageWithSvnDbRequest() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createHttpMessageWithRequestUri("/.svn/entries");
// 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 shouldFilterHttpMessageWithResponseAboveMaxParseSize.
@Test
void shouldFilterHttpMessageWithResponseAboveMaxParseSize() throws Exception {
// Given
int maxParseSizeBytes = 2;
DefaultParseFilter filter = new DefaultParseFilter(createSpiderParam(maxParseSizeBytes), resourceBundle);
HttpMessage httpMessage = createHttpMessageWithResponseBody("ABC");
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(true)));
assertThat(filterResult.getReason(), is(equalTo(FILTERED_REASON_MAX_SIZE)));
}
use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.
the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithGitRequest.
@Test
void shouldNotFilterHttpMessageWithGitRequest() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createHttpMessageWithRequestUri("/.git/index");
// 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 shouldFilterNullHttpMessage.
@Test
void shouldFilterNullHttpMessage() {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = null;
// 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 shouldNotFilterHttpMessageWithSitemapXmlRequestEvenWithoutContentType.
@Test
void shouldNotFilterHttpMessageWithSitemapXmlRequestEvenWithoutContentType() throws Exception {
// Given
DefaultParseFilter filter = createDefaultParseFilter();
HttpMessage httpMessage = createHttpMessageWithRequestUri("/sitemap.xml");
httpMessage.getResponseHeader().setHeader(HttpHeader.CONTENT_TYPE, "");
// When
FilterResult filterResult = filter.filtered(httpMessage);
// Then
assertThat(filterResult.isFiltered(), is(equalTo(false)));
}
Aggregations