Skip to content

Commit

Permalink
Test addded and a previous test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Zaytsev committed Jan 16, 2025
1 parent 0f7220a commit 8f71a61
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class HttpClient
HttpClient(std::string const& address, uint16_t port):
c(ic)
{
c.connect(asio::ip::tcp::endpoint( asio::ip::make_address(address),
port));
c.connect(asio::ip::tcp::endpoint(asio::ip::make_address(address),
port));
}

/** sends a request string through the socket */
Expand Down Expand Up @@ -674,8 +674,8 @@ TEST_CASE("server_handling_error_request_http_version")
try
{
auto resp = HttpClient::request(LOCALHOST_ADDRESS,
45451,
"POST /\r\nContent-Length:3\r\nX-HeaderTest: 123\r\n\r\nA=B\r\n");
45451,
"POST /\r\nContent-Length:3\r\nX-HeaderTest: 123\r\n\r\nA=B\r\n");
FAIL_CHECK();
}
catch (std::exception& e)
Expand Down Expand Up @@ -1987,8 +1987,14 @@ TEST_CASE("middleware_cors")
CHECK(resp.find("Access-Control-Allow-Origin: test.test") != std::string::npos);

resp = HttpClient::request(LOCALHOST_ADDRESS, port,
"GET /auth-origin\r\nOrigin: test-client\r\n\r\n");
"GET /auth-origin\r\nOrigin: test-client\r\n\r\n");
CHECK(resp.find("Access-Control-Allow-Origin: test-client") != std::string::npos);
CHECK(resp.find("Access-Control-Allow-Credentials: true") != std::string::npos);

resp = HttpClient::request(LOCALHOST_ADDRESS, port,
"OPTION /auth-origin\r\nOrigin: test-client\r\n\r\n");
CHECK(resp.find("Access-Control-Allow-Origin: *") != std::string::npos);
CHECK(resp.find("Access-Control-Allow-Credentials: true") == std::string::npos);

resp = HttpClient::request(LOCALHOST_ADDRESS, port,
"GET /expose\r\n\r\n");
Expand Down Expand Up @@ -2403,7 +2409,6 @@ TEST_CASE("multipart")

CHECK(res.code == 400);
CHECK(res.body == "Empty boundary in multipart message");

}

//Boundary that differs from actual boundary
Expand Down

0 comments on commit 8f71a61

Please sign in to comment.