NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
http_client_request结构体 参考

HTTP客户端请求结构 更多...

#include <http_client_message.hpp>

Public 成员函数

NEFORCE_NODISCARD string_view header (const string &key) const noexcept
 获取请求头值
void set_header (const string &key, string value)
 设置请求头
void add_query_param (const string &key, string value)
 添加查询参数
NEFORCE_NODISCARD string build_full_path () const
 构建完整请求路径

Public 属性

http_method method {http_method::GET()}
 HTTP方法
string host
 主机名
ports port
 端口号
string path = "/"
 请求路径
string version = "HTTP/1.1"
 HTTP版本
unordered_map< string, stringheaders
 请求头
unordered_map< string, stringquery_params
 查询参数
string body
 请求正文

详细描述

HTTP客户端请求结构

表示一个HTTP请求,包含方法、URL、头部、查询参数和正文。

在文件 http_client_message.hpp138 行定义.

成员函数说明

◆ add_query_param()

void http_client_request::add_query_param ( const string & key,
string value )
inline

添加查询参数

参数
key参数名
value参数值

在文件 http_client_message.hpp173 行定义.

引用了 move() , 以及 query_params.

◆ build_full_path()

NEFORCE_NODISCARD string http_client_request::build_full_path ( ) const

构建完整请求路径

返回
包含查询参数的完整路径

将path和query_params组合成完整路径。 查询参数会自动进行URL编码。

◆ header()

NEFORCE_NODISCARD string_view http_client_request::header ( const string & key) const
inlinenoexcept

获取请求头值

参数
key头名称
返回
头值,不存在返回空字符串

在文件 http_client_message.hpp153 行定义.

引用了 headers.

◆ set_header()

void http_client_request::set_header ( const string & key,
string value )
inline

设置请求头

参数
key头名称
value头值

在文件 http_client_message.hpp166 行定义.

引用了 headers , 以及 move().


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