com.github.tonivade.zeromock.api.AsyncRequestHandler Maven / Gradle / Ivy
/*
* Copyright (c) 2018-2020, Antonio Gabriel Muñoz Conejo
* Distributed under the terms of the MIT License
*/
package com.github.tonivade.zeromock.api;
import static com.github.tonivade.purefun.concurrent.FutureOf.toFuture;
import com.github.tonivade.purefun.concurrent.Future;
import com.github.tonivade.purefun.concurrent.Future_;
import com.github.tonivade.purefun.instances.FutureInstances;
@FunctionalInterface
public interface AsyncRequestHandler extends RequestHandlerK {
@Override
default Future apply(HttpRequest value) {
return RequestHandlerK.super.apply(value).fix(toFuture());
}
default AsyncRequestHandler preHandle(AsyncPreFilter before) {
return RequestHandlerK.super.preHandle(FutureInstances.monad(), before)::apply;
}
default AsyncRequestHandler postHandle(AsyncPostFilter after) {
return RequestHandlerK.super.postHandle(FutureInstances.monad(), after)::apply;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy