| 151 | |
| 152 | |
| 153 | TEST(DecoderTest, Response) |
| 154 | { |
| 155 | ResponseDecoder decoder; |
| 156 | |
| 157 | const string data = |
| 158 | "HTTP/1.1 200 OK\r\n" |
| 159 | "Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n" |
| 160 | "Content-Type: text/plain\r\n" |
| 161 | "Content-Length: 2\r\n" |
| 162 | "\r\n" |
| 163 | "hi"; |
| 164 | |
| 165 | deque<http::Response*> responses = decoder.decode(data.data(), data.length()); |
| 166 | ASSERT_FALSE(decoder.failed()); |
| 167 | ASSERT_EQ(1u, responses.size()); |
| 168 | |
| 169 | Owned<http::Response> response(responses[0]); |
| 170 | |
| 171 | EXPECT_EQ("200 OK", response->status); |
| 172 | EXPECT_EQ(http::Response::BODY, response->type); |
| 173 | EXPECT_EQ("hi", response->body); |
| 174 | |
| 175 | EXPECT_EQ(3u, response->headers.size()); |
| 176 | } |
| 177 | |
| 178 | |
| 179 | TEST(DecoderTest, ResponseWithUnspecifiedLength) |
nothing calls this directly
no test coverage detected