10#include <userver/clients/http/config.hpp>
11#include <userver/clients/http/response.hpp>
12#include <userver/compiler/select.hpp>
13#include <userver/engine/deadline.hpp>
14#include <userver/engine/future.hpp>
15#include <userver/engine/impl/context_accessor.hpp>
17USERVER_NAMESPACE_BEGIN
19namespace clients::http {
29class ResponseFuture
final {
31 ResponseFuture(ResponseFuture&& other)
noexcept;
32 ResponseFuture& operator=(ResponseFuture&&)
noexcept;
33 ResponseFuture(
const ResponseFuture&) =
delete;
34 ResponseFuture& operator=(
const ResponseFuture&) =
delete;
41 std::future_status Wait();
43 std::shared_ptr<Response> Get();
45 void SetCancellationPolicy(CancellationPolicy cp);
49 engine::impl::ContextAccessor* TryGetContextAccessor()
noexcept;
51 ResponseFuture(engine::Future<std::shared_ptr<Response>>&& future, std::shared_ptr<RequestState> request);
55 void CancelOrDetach();
57 engine::Future<std::shared_ptr<Response>> future_;
58 engine::Deadline deadline_;
59 std::shared_ptr<RequestState> request_state_;
60 bool was_deadline_propagated_{
false};
61 CancellationPolicy cancellation_policy_;