8#include <userver/clients/http/error.hpp>
9#include <userver/clients/http/local_stats.hpp>
10#include <userver/http/header_map.hpp>
11#include <userver/http/status_code.hpp>
12#include <userver/server/http/http_response_cookie.hpp>
13#include <userver/utils/str_icase.hpp>
15USERVER_NAMESPACE_BEGIN
17namespace clients::
http {
19using Status = USERVER_NAMESPACE::http::
StatusCode;
22using Headers = USERVER_NAMESPACE::http::
headers::HeaderMap;
27 using CookiesMap = server::http::Cookie::CookiesMap;
35 std::string
body()
const& {
return response_; }
36 std::string&& body() && {
return std::move(response_); }
42 const Headers&
headers()
const {
return headers_; }
43 Headers& headers() {
return headers_; }
44 const CookiesMap& cookies()
const {
return cookies_; }
45 CookiesMap& cookies() {
return cookies_; }
51 bool IsError()
const {
return static_cast<uint16_t>(
status_code()) >= 400; }
53 static void RaiseForStatus(
int code,
const LocalStats& stats);
55 void raise_for_status()
const;
61 void SetStats(
const LocalStats& stats) { stats_ = stats; }
62 void SetStatusCode(Status status_code) { status_code_ = status_code; }
67 std::string response_;
68 Status status_code_{Status::Invalid};