Added correct headers for the Daemon to POST json content

This commit is contained in:
Pranay Sharma
2014-12-18 11:40:55 +05:30
committed by Matt Hill
parent 5a68f23064
commit a9e1e16709

View File

@@ -450,11 +450,19 @@ bool uploadPost(std::string url, std::string data)
bool success = true;
CURL *curl;
CURLcode res;
struct curl_slist *headers=NULL; // init to NULL is important
/* Add the required headers */
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append( headers, "Content-Type: application/json");
headers = curl_slist_append( headers, "charsets: utf-8");
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* Add the headers */
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */