stuff-from-scratch/test/network/TestWinsockClient.cpp

26 lines
510 B
C++
Raw Normal View History

2023-01-27 17:04:39 +00:00
#include "NetworkManager.h"
#include "TestFramework.h"
#include "TestUtils.h"
#include "HttpClient.h"
#include "File.h"
TEST_CASE(TestWinsockClient, "network")
{
HttpClient client;
HttpRequest request(HttpRequest::Verb::GET);
HttpClient::Address address;
address.mHost = "127.0.0.1";
address.mPort = 8000;
auto response = client.makeRequest(request, address);
auto content = response.toString();
File file(TestUtils::getTestOutputDir(__FILE__) / "get_request.dat");
file.writeText(content);
}