asio2 icon indicating copy to clipboard operation
asio2 copied to clipboard

请问下现在库里面有对http跨域请求的支持选项吗

Open berry0511 opened this issue 1 year ago • 1 comments

RT

berry0511 avatar Jan 04 '24 10:01 berry0511

void set_cors(http::web_request& req, auto& res)
{
	if (m_config.enable_cors)
	{
		res.set("Access-Control-Allow-Headers", "x-requested-with,Content-Type,Authorization");
		res.set("Access-Control-Allow-Methods", "POST,GET");
		if (auto it = req.find(http::field::origin); it != req.end())
			res.set("Access-Control-Allow-Origin", it->value());
	}
}

上面是我用的一段示例代码,想直接设置一个选项就支持跨域的,没有这个功能

zhllxt avatar Jan 04 '24 11:01 zhllxt