1 | #define CTEST_MAIN |
---|---|
2 | #include "ctest.h" |
3 | |
4 | #include "common.h" |
5 | |
6 | #include "http_message.h" |
7 | |
8 | CTEST(test_rpc, call) |
9 | { |
10 | char* data = "GET /hello HTTP/1.1\r\n" |
11 | "Host: example.com\r\n" |
12 | "User-Agent: curl/7.68.0\r\n" |
13 | "Accept: */*\r\n" |
14 | "\r\n"; |
15 | |
16 | vws_http_msg* req = vws_http_msg_new(HTTP_REQUEST); |
17 | |
18 | vws_http_msg_parse(req, data, strlen(data)); |
19 | ASSERT_TRUE(req->headers_complete == true); |
20 | |
21 | printf("\n"); |
22 | |
23 | cstr key; cstr value; |
24 | sc_map_foreach(&req->headers, key, value) |
25 | { |
26 | printf("Header: %s: %s\n", key, value); |
27 | } |
28 | |
29 | vws_http_msg_free(req); |
30 | } |
31 | |
32 | int main(int argc, const char* argv[]) |
33 | { |
34 | return ctest_main(argc, argv); |
35 | } |
36 |