2024-08-20 14:35:05 +00:00
|
|
|
#include <string>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "requests.h"
|
|
|
|
|
|
|
|
TEST(RequestsTest, HttpsGetTest) {
|
|
|
|
requestsInit();
|
|
|
|
std::string expected = "<!DOCTYPE html>\n<html >\n<head><meta charset=\"utf-8\">\n<title>Ben Shiller</title>";
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
2024-08-20 14:38:47 +00:00
|
|
|
GetRequestResult result = requestsGet("https://shillerben.com");
|
2024-08-20 14:35:05 +00:00
|
|
|
// std::cout << "GET https://shillerben.com returned: " << result.data << '\n';
|
|
|
|
ASSERT_EQ(strncmp(result.data, expected.c_str(), expected.size()), 0);
|
|
|
|
free(result.data);
|
|
|
|
}
|
|
|
|
requestsCleanup();
|
|
|
|
}
|