ADD: changed the way of retreiving the result from the curl request

This commit is contained in:
Henry Winkel
2023-10-27 10:44:57 +02:00
parent 052fe52489
commit be81f87154
7 changed files with 40 additions and 92 deletions

View File

@@ -10,7 +10,6 @@
#include <fstream>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
#include <kubecontrol/WriterMemoryClass.hpp>
#include <loguru.hpp>
#include <nlohmann/json.hpp>

View File

@@ -1,38 +0,0 @@
#pragma once
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#define MAX_FILE_LENGTH 200000
class WriterMemoryClass
{
public:
// Callback must be declared static, otherwise it won't link...
size_t WriteMemoryCallback(char* ptr, size_t size, size_t nmemb)
{
str_pBuffer.erase();
str_pBuffer = std::string(ptr);
return str_pBuffer.size();
};
std::string getResponse()
{
// return std::string(m_pBuffer);
return str_pBuffer;
}
void print()
{
std::cout << "Size: " << str_pBuffer.size() << std::endl;
std::cout << "Content: " << std::endl << str_pBuffer << std::endl;
}
// Public member vars
private:
std::string str_pBuffer;
};