Make it build again

This commit is contained in:
Ben Shiller 2024-08-20 09:38:47 -05:00
parent cf9e6955e8
commit 38eac9e9dc
4 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
int main(void) { int main(void) {
printf("Hello, world!\n"); printf("Hello, world!\n");
requestInit(); requestsInit();
requestGet("https://google.com"); requestsGet("https://google.com");
requestCleanup(); requestsCleanup();
} }

View File

@ -17,7 +17,7 @@ struct GetRequestResult {
void requestsInit(void); void requestsInit(void);
void requestsCleanup(void); void requestsCleanup(void);
GetRequestResult requestGet(const char* url); GetRequestResult requestsGet(const char* url);
size_t _getRequestCb(char *buffer, size_t size, size_t nmemb, GetRequestResult *result); size_t _getRequestCb(char *buffer, size_t size, size_t nmemb, GetRequestResult *result);

View File

@ -14,7 +14,7 @@ void requestsCleanup(void) {
curl_global_cleanup(); curl_global_cleanup();
} }
GetRequestResult requestGet(const char* url) { GetRequestResult requestsGet(const char* url) {
printf("requestGet(%s)\n", url); printf("requestGet(%s)\n", url);
GetRequestResult result = { GetRequestResult result = {

View File

@ -7,7 +7,7 @@ TEST(RequestsTest, HttpsGetTest) {
requestsInit(); requestsInit();
std::string expected = "<!DOCTYPE html>\n<html >\n<head><meta charset=\"utf-8\">\n<title>Ben Shiller</title>"; 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) { for (int i = 0; i < 10; ++i) {
GetRequestResult result = requestGet("https://shillerben.com"); GetRequestResult result = requestsGet("https://shillerben.com");
// std::cout << "GET https://shillerben.com returned: " << result.data << '\n'; // std::cout << "GET https://shillerben.com returned: " << result.data << '\n';
ASSERT_EQ(strncmp(result.data, expected.c_str(), expected.size()), 0); ASSERT_EQ(strncmp(result.data, expected.c_str(), expected.size()), 0);
free(result.data); free(result.data);