RMVL  2.3.0
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
rm::Response结构体 参考

HTTP 响应 更多...

#include <rmvl/io/netapp.hpp>

rm::Response 的协作图:

Public 成员函数

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
 

静态 Public 成员函数

static Response parse (std::string_view str)
 解析 HTTP 响应
 

Public 属性

uint16_t status {}
 响应行:状态码
 
std::string message {}
 响应行:状态消息
 
std::unordered_map< std::string, std::string > heads {}
 响应头
 
std::string body {}
 响应数据
 

详细描述

HTTP 响应

成员函数说明

◆ generate()

std::string rm::Response::generate ( )

生成 HTTP 响应报文

返回
响应报文

◆ json()

void rm::Response::json ( std::string_view str)

发送 JSON 格式的响应数据

参数
[in]strJSON 字符串

◆ operator bool()

rm::Response::operator bool ( ) const
inlinenoexcept

◆ parse()

static Response rm::Response::parse ( std::string_view str)
static

解析 HTTP 响应

参数
[in]strHTTP 响应报文
返回
解析后的响应对象

◆ redirect() [1/2]

void rm::Response::redirect ( std::string_view url)
inline

发送重定向响应

参数
[in]url重定向的 URL
函数调用图:

◆ 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)

发送响应数据

参数
[in]str响应数据

◆ sendFile()

void rm::Response::sendFile ( std::string_view file)

发送文件内容作为响应

参数
[in]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 {}

响应行:状态码


该结构体的文档由以下文件生成: