Provides static utility functions for HTTP requests and data formatting.
More...
#include <Utils.hpp>
|
static std::string | boolToString (bool value) |
| Convert a boolean to a string ("true"/"false").
|
|
static int | deleteRequest (const std::string &url, const std::vector< std::string > &headers, std::string &response) |
| Make an HTTP DELETE request.
|
|
static std::string | escapeJsonString (const std::string &input) |
| Escape special characters in a JSON string.
|
|
static int | getRequest (const std::string &url, const std::vector< std::string > &headers, std::string &response) |
| Make an HTTP GET request.
|
|
static int | patchRequest (const std::string &url, const std::string &payload, const std::vector< std::string > &headers, std::string &response) |
| Make an HTTP PATCH request.
|
|
static int | postRequest (const std::string &url, const std::string &payload, const std::vector< std::string > &headers, std::string &response) |
| Make an HTTP POST request.
|
|
static int | putRequest (const std::string &url, const std::string &payload, const std::vector< std::string > &headers, std::string &response) |
| Make an HTTP PUT request.
|
|
static std::string | urlEncode (const std::string &value) |
| URL-encode a string.
|
|
Provides static utility functions for HTTP requests and data formatting.
Definition at line 15 of file Utils.hpp.
◆ boolToString()
static std::string Utils::boolToString |
( |
bool |
value | ) |
|
|
static |
Convert a boolean to a string ("true"/"false").
- Parameters
-
- Returns
- std::string "true" or "false".
◆ deleteRequest()
static int Utils::deleteRequest |
( |
const std::string & |
url, |
|
|
const std::vector< std::string > & |
headers, |
|
|
std::string & |
response |
|
) |
| |
|
static |
Make an HTTP DELETE request.
- Parameters
-
url | Endpoint URL. |
headers | List of HTTP headers. |
response | Output string to store server response. |
- Returns
- int HTTP response code.
◆ escapeJsonString()
static std::string Utils::escapeJsonString |
( |
const std::string & |
input | ) |
|
|
static |
Escape special characters in a JSON string.
- Parameters
-
- Returns
- std::string Escaped JSON string.
◆ getRequest()
static int Utils::getRequest |
( |
const std::string & |
url, |
|
|
const std::vector< std::string > & |
headers, |
|
|
std::string & |
response |
|
) |
| |
|
static |
Make an HTTP GET request.
- Parameters
-
url | Endpoint URL. |
headers | List of HTTP headers. |
response | Output string to store server response. |
- Returns
- int HTTP response code.
◆ patchRequest()
static int Utils::patchRequest |
( |
const std::string & |
url, |
|
|
const std::string & |
payload, |
|
|
const std::vector< std::string > & |
headers, |
|
|
std::string & |
response |
|
) |
| |
|
static |
Make an HTTP PATCH request.
- Parameters
-
url | Endpoint URL. |
payload | JSON payload to send. |
headers | List of HTTP headers. |
response | Output string to store server response. |
- Returns
- int HTTP response code.
◆ postRequest()
static int Utils::postRequest |
( |
const std::string & |
url, |
|
|
const std::string & |
payload, |
|
|
const std::vector< std::string > & |
headers, |
|
|
std::string & |
response |
|
) |
| |
|
static |
Make an HTTP POST request.
- Parameters
-
url | Endpoint URL. |
payload | JSON payload to send. |
headers | List of HTTP headers. |
response | Output string to store server response. |
- Returns
- int HTTP response code.
◆ putRequest()
static int Utils::putRequest |
( |
const std::string & |
url, |
|
|
const std::string & |
payload, |
|
|
const std::vector< std::string > & |
headers, |
|
|
std::string & |
response |
|
) |
| |
|
static |
Make an HTTP PUT request.
- Parameters
-
url | Endpoint URL. |
payload | JSON payload to send. |
headers | List of HTTP headers. |
response | Output string to store server response. |
- Returns
- int HTTP response code.
◆ urlEncode()
static std::string Utils::urlEncode |
( |
const std::string & |
value | ) |
|
|
static |
URL-encode a string.
- Parameters
-
- Returns
- std::string URL-encoded string.
The documentation for this class was generated from the following file: