HTTP 响应
更多...
#include <rmvl/io/netapp.hpp>
|
| std::string | generate () |
| | 生成 HTTP 响应报文
|
| |
| void | send (std::string_view str) |
| | 发送响应数据
|
| |
| void | sendFile (std::string_view file) |
| | 发送文件内容作为响应
|
| |
| void | json (std::string_view str) |
| | 发送 JSON 格式的响应数据
|
| |
| void | redirect (std::string_view url) |
| | 发送重定向响应
|
| |
| void | redirect (uint16_t code, std::string_view url) |
| | 重定向响应
|
| |
| | operator bool () const noexcept |
| |
|
| uint16_t | status {} |
| | 响应行:状态码
|
| |
| std::string | message {} |
| | 响应行:状态消息
|
| |
| std::unordered_map< std::string, std::string > | heads {} |
| | 响应头
|
| |
| std::string | body {} |
| | 响应数据
|
| |
◆ generate()
| std::string rm::Response::generate |
( |
| ) |
|
◆ json()
| void rm::Response::json |
( |
std::string_view | str | ) |
|
◆ operator bool()
| rm::Response::operator bool |
( |
| ) |
const |
|
inlinenoexcept |
◆ parse()
| static Response rm::Response::parse |
( |
std::string_view | str | ) |
|
|
static |
◆ redirect() [1/2]
| void rm::Response::redirect |
( |
std::string_view | url | ) |
|
|
inline |
◆ redirect() [2/2]
| void rm::Response::redirect |
( |
uint16_t | code, |
|
|
std::string_view | url ) |
重定向响应
- 参数
-
| [in] | code | 状态码 |
| [in] | url | 重定向的 URL |
◆ send()
| void rm::Response::send |
( |
std::string_view | str | ) |
|
◆ sendFile()
| void rm::Response::sendFile |
( |
std::string_view | file | ) |
|
◆ body
| std::string rm::Response::body {} |
◆ heads
| std::unordered_map<std::string, std::string> rm::Response::heads {} |
◆ message
| std::string rm::Response::message {} |
◆ status
| uint16_t rm::Response::status {} |
该结构体的文档由以下文件生成: