class RequestPropertyFilter {

    public static FilterResult filterProperty(HttpServerRequest request, String filterPropertyKey, String filterPropertyValue, boolean reject) {

        CaseInsensitiveHeaders headers = new CaseInsensitiveHeaders();
        headers.setAll(request.headers());

        if (URL.equals(filterPropertyKey)) {
            boolean matches = filterRequestURL(request, filterPropertyValue);
            FilterResult result = rejectIfNeeded(reject, matches);
            logFilterResult(request, filterPropertyKey, filterPropertyValue, result);
            return result;
        }
        if (METHOD.equals(filterPropertyKey)) {
            boolean matches = filterRequestMethod(request, filterPropertyValue);
            FilterResult result = rejectIfNeeded(reject, matches);
            logFilterResult(request, filterPropertyKey, filterPropertyValue, result);
            return result;
        }
        if (headers.names().contains(filterPropertyKey) && headers.get(filterPropertyKey).equalsIgnoreCase(filterPropertyValue)) {
            FilterResult result = reject ? FilterResult.REJECT : FilterResult.FILTER;
            logFilterResult(request, filterPropertyKey, filterPropertyValue, result);
            return result;
        }
        logFilterResult(request, filterPropertyKey, filterPropertyValue, FilterResult.REJECT, true);
        return FilterResult.REJECT;
    }

}

class RequestPropertyFilterTest {

    private final String METHOD_PUT;
    private final String METHOD_PUT_POST_REGEX;
    private final String METHOD_GET;
    private final String PUT_REQUEST_REGEX;
    private final String PUT_REQUEST_URI;
    private final String OTHER_PUT_REQUEST_URI;

    @Test
    public void testPropertyMethodNoMatchRequest(TestContext context){

        context.assertEquals(FilterResult.NO_MATCH,
                RequestPropertyFilter.filterProperty(new PUTRequest(), RequestPropertyFilter.METHOD, METHOD_GET, false));

        // check again with reject = true
        context.assertEquals(FilterResult.NO_MATCH,
                RequestPropertyFilter.filterProperty(new PUTRequest(), RequestPropertyFilter.METHOD, METHOD_GET, true));
    }

}