001
002package io.vrap.rmf.base.client.http;
003
004import java.util.Set;
005import java.util.function.Predicate;
006
007import io.vrap.rmf.base.client.ApiHttpMethod;
008import io.vrap.rmf.base.client.ApiHttpRequest;
009
010/**
011 * Middleware to convert a {@link io.vrap.rmf.base.client.error.NotFoundException} to a response with a null body value
012 */
013public interface NotFoundExceptionMiddleware extends Middleware {
014
015    static NotFoundExceptionMiddleware of() {
016        return new NotFoundExceptionMiddlewareImpl();
017    }
018
019    static NotFoundExceptionMiddleware of(final Set<ApiHttpMethod> methods) {
020        return new NotFoundExceptionMiddlewareImpl(apiHttpRequest -> methods.contains(apiHttpRequest.getMethod()));
021    }
022
023    static NotFoundExceptionMiddleware of(final Predicate<ApiHttpRequest> requestPredicate) {
024        return new NotFoundExceptionMiddlewareImpl(requestPredicate);
025    }
026}