获取请求
小于 1 分钟hyperlanewebrust
获取请求
// 省略 server 和 路由处理函数 创建
let controller_data = arc_lock_controller_data.write().unwrap();
let request: Request = controller_data.get_request().clone();
获取 method
let method = request.get_method();
获取 host
let host = request.get_host();
获取 path
let path = request.get_path();
获取 query
let query = request.get_query();
获取 hash
let hash = request.get_hash();
获取 headers
let headers = request.get_headers();
获取 body
let body = request.get_body();
修改请求
// 省略 server 和 路由处理函数 创建
let mut controller_data = arc_lock_controller_data.write().unwrap();
let request: &mut Request = controller_data.get_mut_request();
修改 method
request.set_method(GET.to_owned());
修改 host
request.set_host("localhost".to_owned());
修改 path
request.set_path("server".to_owned());
修改 query
request.set_query("server".to_owned());
修改 hash
request.set_hash("server".to_owned());
修改 headers
request.set_header("server", "hyperlane");
request.set_headers(HashMap::new());
修改 body
request.set_body(vec![]);