我正在做发布请求,为此我必须设置标题内容类型,application/json
因为我正在编写以下代码:
struct curl_slist *headers = NULL;
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");
res = curl_easy_setopt(curl, CURLOPT_HEADER,headers);
但是当我编译程序时,错误是
Accept: */*
Proxy-Connection: Keep-Alive
Content-Length: 22
Content-Type: application/x-www-form-urlencoded
application/json
请尽快帮我设置此内容类型