File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include " test_helpers.hpp"
21
21
#include " test_suite.hpp"
22
22
23
+ #include < stdexcept>
23
24
#include < vector>
24
25
25
26
namespace boost {
@@ -127,6 +128,22 @@ struct fields_base_test
127
128
res.capacity_in_bytes (), 0 );
128
129
}
129
130
131
+ {
132
+ fields f (" \r\n " );
133
+ auto const n =
134
+ f.capacity_in_bytes ();
135
+ BOOST_TEST_GT (n, 0 );
136
+ BOOST_TEST_EQ (
137
+ f.buffer (),
138
+ " \r\n " );
139
+ }
140
+
141
+ {
142
+ BOOST_TEST_THROWS (
143
+ fields (" HTTP/1.1" ),
144
+ std::invalid_argument);
145
+ }
146
+
130
147
{
131
148
fields f (
132
149
" digest: ffce\r\n "
@@ -143,6 +160,28 @@ struct fields_base_test
143
160
f.capacity_in_bytes (), n);
144
161
}
145
162
163
+ {
164
+ request req (
165
+ " POST / HTTP/1.1\r\n "
166
+ " \r\n " );
167
+ auto const n =
168
+ req.capacity_in_bytes ();
169
+ BOOST_TEST_EQ (
170
+ req.buffer (),
171
+ " POST / HTTP/1.1\r\n\r\n " );
172
+ BOOST_TEST_EQ (
173
+ req.capacity_in_bytes (), n);
174
+ }
175
+
176
+ {
177
+ BOOST_TEST_THROWS (
178
+ request (
179
+ " POST / HTTP/1.1"
180
+ " \r\n " ),
181
+ std::invalid_argument
182
+ );
183
+ }
184
+
146
185
{
147
186
request req (
148
187
" POST / HTTP/1.1\r\n "
@@ -161,6 +200,27 @@ struct fields_base_test
161
200
req.capacity_in_bytes (), n);
162
201
}
163
202
203
+ {
204
+ response res (
205
+ " HTTP/1.1 404 Not Found\r\n "
206
+ " \r\n " );
207
+ auto const n =
208
+ res.capacity_in_bytes ();
209
+ BOOST_TEST_EQ (
210
+ res.buffer (),
211
+ " HTTP/1.1 404 Not Found\r\n\r\n " );
212
+ BOOST_TEST_EQ (
213
+ res.capacity_in_bytes (), n);
214
+ }
215
+
216
+ {
217
+ BOOST_TEST_THROWS (
218
+ response (
219
+ " HTTP/1.1 404 Not Found"
220
+ " \r\n " ),
221
+ std::invalid_argument);
222
+ }
223
+
164
224
{
165
225
response res (
166
226
" HTTP/1.1 404 Not Found\r\n "
You can’t perform that action at this time.
0 commit comments