fix ssl handshake and parsing issues

This commit is contained in:
Chunting Gu
2021-06-15 17:09:04 +08:00
parent 52fbba705b
commit e27338854c
10 changed files with 115 additions and 41 deletions
+8 -11
View File
@@ -15,27 +15,24 @@ int main() {
webcc::ResponsePtr r;
try {
r = session.Send(webcc::RequestBuilder{}.
Get("http://httpbin.org/get").
Query("name", "Adam Gu", /*encode*/true).Date()
());
r = session.Send(WEBCC_GET("http://httpbin.org/get")
.Query("name", "Adam Gu", true)
.Date()());
assert(r->status() == webcc::Status::kOK);
assert(!r->data().empty());
r = session.Send(webcc::RequestBuilder{}.
Post("http://httpbin.org/post").
Body("{'name'='Adam', 'age'=20}").Json().Utf8()
());
r = session.Send(WEBCC_POST("http://httpbin.org/post")
.Body("{'name'='Adam', 'age'=20}")
.Json()
.Utf8()());
assert(r->status() == webcc::Status::kOK);
assert(!r->data().empty());
#if WEBCC_ENABLE_SSL
r = session.Send(webcc::RequestBuilder{}.
Get("https://httpbin.org/get")
());
r = session.Send(WEBCC_GET("https://httpbin.org/get")());
assert(r->status() == webcc::Status::kOK);
assert(!r->data().empty());