| 983 | } |
| 984 | |
| 985 | void |
| 986 | testBody() |
| 987 | { |
| 988 | parsegrind<test_parser<false>>( |
| 989 | "HTTP/1.1 200 OK\r\n" |
| 990 | "Transfer-Encoding: chunked\r\n" |
| 991 | "Content-Type: application/octet-stream\r\n" |
| 992 | "\r\n" |
| 993 | "4\r\nabcd\r\n" |
| 994 | "0\r\n\r\n" |
| 995 | ,[&](test_parser<false> const& p) |
| 996 | { |
| 997 | BEAST_EXPECT(p.body == "abcd"); |
| 998 | }); |
| 999 | parsegrind<test_parser<false>>( |
| 1000 | "HTTP/1.1 200 OK\r\n" |
| 1001 | "Server: test\r\n" |
| 1002 | "Expect: Expires, MD5-Fingerprint\r\n" |
| 1003 | "Transfer-Encoding: chunked\r\n" |
| 1004 | "\r\n" |
| 1005 | "5\r\n" |
| 1006 | "*****\r\n" |
| 1007 | "2;a;b=1;c=\"2\"\r\n" |
| 1008 | "--\r\n" |
| 1009 | "0;d;e=3;f=\"4\"\r\n" |
| 1010 | "Expires: never\r\n" |
| 1011 | "MD5-Fingerprint: -\r\n" |
| 1012 | "\r\n" |
| 1013 | ,[&](test_parser<false> const& p) |
| 1014 | { |
| 1015 | BEAST_EXPECT(p.body == "*****--"); |
| 1016 | }); |
| 1017 | |
| 1018 | parsegrind<test_parser<true>>( |
| 1019 | "GET / HTTP/1.1\r\n" |
| 1020 | "Content-Length: 1\r\n" |
| 1021 | "\r\n" |
| 1022 | "1", |
| 1023 | expect_body(*this, "1")); |
| 1024 | |
| 1025 | parsegrind<test_parser<false>>( |
| 1026 | "HTTP/1.0 200 OK\r\n" |
| 1027 | "\r\n" |
| 1028 | "hello", |
| 1029 | expect_body(*this, "hello")); |
| 1030 | |
| 1031 | parsegrind<test_parser<true>>(buffers_cat( |
| 1032 | buf("GET / HTTP/1.1\r\n" |
| 1033 | "Content-Length: 10\r\n" |
| 1034 | "\r\n"), |
| 1035 | buf("12"), |
| 1036 | buf("345"), |
| 1037 | buf("67890"))); |
| 1038 | |
| 1039 | // request without Content-Length or |
| 1040 | // Transfer-Encoding: chunked has no body. |
| 1041 | { |
| 1042 | error_code ec; |
nothing calls this directly
no test coverage detected