VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
HttpResult.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <string>
5
6namespace VoltMod
7{
8
9/** How an HTTP request ended. */
11{
12 bool Ok = false; ///< the server answered, with any status; when false, Error says why
13 long StatusCode = 0;
14 std::string Body;
15 std::string Error;
16
17 /** The server answered with a 2xx status. */
18 bool IsSuccess() const { return Ok && StatusCode >= 200 && StatusCode < 300; }
19};
20
21using HttpCompletion = std::function<void(const HttpResult&)>;
22
23} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
std::function< void(const HttpResult &)> HttpCompletion
bool Ok
the server answered, with any status; when false, Error says why
bool IsSuccess() const