Test for issue where POST requests time out

feature/UrlUtils
Kenneth Barbour 2018-11-26 14:49:12 -05:00
parent 1f2ecdd365
commit 0aa588aecf
1 changed files with 16 additions and 0 deletions

View File

@ -86,3 +86,19 @@ TEST_CASE("Test parse POST then GET", "[RequestParser][POSTthenGET]")
CHECK_THAT(request.getUrl(), Equals("/foo"));
CHECK_THAT(request.getMethod(), Equals("GET"));
}
TEST_CASE("More POST testing", "[RequestParser][POST]")
{
uint8_t buff[512] = {};
Buffer client(buff, 512);
HttpRequest request;
RequestParser parser(request, client);
client.write("POST / HTTP/1.1\r\nHost: localhost:8080\r\nUser-Agent: curl/7.55.1\r\nAccept: */*\r\nContent-Length: 3\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nfoo");
CHECK(parser.parse());
CHECK(!client.available());
CHECK_THAT(request.getUrl(), Equals("/"));
CHECK_THAT(request.headers.get("Host"), Equals("localhost:8080"));
CHECK_THAT(request.headers.get("Content-Length"), Equals("3"));
}