-
Notifications
You must be signed in to change notification settings - Fork 37
Description
What is the way to modify the below sample to send a POST request?
By default performRequest makes a GET request as per the examples.
``#include <NFHTTP/NFHTTP.h>
#include
#include
#include <nlohmann/json.hpp>
using namespace std;
int main()
{
auto client = nativeformat::http::createClient(nativeformat::http::standardCacheLocation(),"NFHTTP-" + nativeformat::http::version());
const std::string url = "http://www.google.com";
auto request = nativeformat::http::createRequest(url, std::unordered_map<std::string, std::string>());
auto token = client->performRequest(request, [](const std::shared_ptrnativeformat::http::Response &response) {
size_t data_length = 0;
printf("Received Response: %s\n", response->data(data_length));
});
auto response = client->performRequestSynchronously(request);
size_t data_length = 0;
printf("Received Response: %s\n", response->data(data_length));
return 0;
}``