diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index fff7619d8..df22fe988 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -338,7 +338,7 @@ public: /// \brief Default constructor /// //////////////////////////////////////////////////////////// - Http(); + Http() = default; //////////////////////////////////////////////////////////// /// \brief Construct the HTTP client with the target host diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index f9ee0d542..3e9e705de 100644 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp @@ -286,10 +286,6 @@ void Http::Response::parseFields(std::istream& in) } -//////////////////////////////////////////////////////////// -Http::Http() = default; - - //////////////////////////////////////////////////////////// Http::Http(const std::string& host, unsigned short port) { diff --git a/test/Network/Http.test.cpp b/test/Network/Http.test.cpp index 71e8cc65e..bc362af37 100644 --- a/test/Network/Http.test.cpp +++ b/test/Network/Http.test.cpp @@ -1,8 +1,48 @@ #include +#include + #include -static_assert(!std::is_copy_constructible_v); -static_assert(!std::is_copy_assignable_v); -static_assert(!std::is_nothrow_move_constructible_v); -static_assert(!std::is_nothrow_move_assignable_v); +TEST_CASE("[Network] sf::Http") +{ + SECTION("Type traits") + { + STATIC_CHECK(!std::is_copy_constructible_v); + STATIC_CHECK(!std::is_copy_assignable_v); + STATIC_CHECK(!std::is_nothrow_move_constructible_v); + STATIC_CHECK(!std::is_nothrow_move_assignable_v); + } + + SECTION("Request") + { + SECTION("Type traits") + { + STATIC_CHECK(std::is_copy_constructible_v); + STATIC_CHECK(std::is_copy_assignable_v); + STATIC_CHECK(std::is_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); + } + } + + SECTION("Response") + { + SECTION("Type traits") + { + STATIC_CHECK(std::is_copy_constructible_v); + STATIC_CHECK(std::is_copy_assignable_v); + STATIC_CHECK(std::is_move_constructible_v); + STATIC_CHECK(std::is_nothrow_move_assignable_v); + } + + SECTION("Construction") + { + const sf::Http::Response response; + CHECK(response.getField("").empty()); + CHECK(response.getStatus() == sf::Http::Response::Status::ConnectionFailed); + CHECK(response.getMajorHttpVersion() == 0); + CHECK(response.getMinorHttpVersion() == 0); + CHECK(response.getBody().empty()); + } + } +}