| 239 | } |
| 240 | |
| 241 | void CheckResponseCode(bool expect_empty, int expect_code) { |
| 242 | int bytes_in_pipe = 0; |
| 243 | ioctl(_pipe_fds[0], FIONREAD, &bytes_in_pipe); |
| 244 | if (expect_empty) { |
| 245 | EXPECT_EQ(0, bytes_in_pipe); |
| 246 | return; |
| 247 | } |
| 248 | |
| 249 | EXPECT_GT(bytes_in_pipe, 0); |
| 250 | butil::IOPortal buf; |
| 251 | EXPECT_EQ((ssize_t)bytes_in_pipe, |
| 252 | buf.append_from_file_descriptor(_pipe_fds[0], 1024)); |
| 253 | brpc::ParseResult pr = |
| 254 | brpc::policy::ParseHttpMessage(&buf, _socket.get(), false, NULL); |
| 255 | EXPECT_EQ(brpc::PARSE_OK, pr.error()); |
| 256 | brpc::policy::HttpContext* msg = |
| 257 | static_cast<brpc::policy::HttpContext*>(pr.message()); |
| 258 | |
| 259 | EXPECT_EQ(expect_code, msg->header().status_code()); |
| 260 | msg->Destroy(); |
| 261 | } |
| 262 | |
| 263 | void MakeH2EchoRequestBuf(butil::IOBuf* out, brpc::Controller* cntl, int* h2_stream_id) { |
| 264 | butil::IOBuf request_buf; |
nothing calls this directly
no test coverage detected