update:http&&md5
This commit is contained in:
18
README.md
18
README.md
@@ -108,3 +108,21 @@ auto s = req.getStats();
|
||||
说明:
|
||||
- 若使用 HTTPS,需在编译时添加 `-DCPPHTTPLIB_OPENSSL_SUPPORT` 并链接 `-lssl -lcrypto`,且将 `opt.scheme` 设为 `"https"`、端口通常为 `443`。
|
||||
- `base_path` 与各函数传入的 `path` 会自动合并,例如 `base_path="/api"` 且 `Get("/info")` 实际请求路径为 `/api/info`。
|
||||
|
||||
7) 快速用法(无需实例化)
|
||||
```cpp
|
||||
using ntq::NetRequest;
|
||||
|
||||
// 直接传完整 URL 发起 GET
|
||||
auto g = NetRequest::QuickGet("http://127.0.0.1:8080/api/info");
|
||||
|
||||
// 直接传完整 URL 发起 POST(JSON)
|
||||
auto p1 = NetRequest::QuickPostJson(
|
||||
"http://127.0.0.1:8080/api/set",
|
||||
R"({"name":"orangepi","mode":"demo"})"
|
||||
);
|
||||
|
||||
// 直接传完整 URL 发起 POST(表单)
|
||||
httplib::Params form = {{"user","abc"},{"pwd","123"}};
|
||||
auto p2 = NetRequest::QuickPostForm("http://127.0.0.1:8080/login", form);
|
||||
```
|
||||
|
Reference in New Issue
Block a user