libcurl curl_easy_perform returns OK,但是没有调用响应回调函数

libcurl curl_easy_perform returns OK,but the response callback function was not called

我post向服务器发送json消息,服务器应该给出响应。

当我使用 PostMan 测试服务器时,我可以得到响应。

但是我的 linux 代码 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, respCallBack); 好像不行。

这是我的 headers:

    /* add HTTP header */
        headers = curl_slist_append(headers, "Accept:text/plain");
        headers = curl_slist_append(headers, "Content-Type:application/json");
        headers = curl_slist_append(headers, "Expect:");

这里是 curl 选项:

    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_URL, url);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
    curl_easy_setopt(curl, CURLOPT_POST, 1L);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (void *)param);
    curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, connTimeout);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, respCallBack);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, resp);
    curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)errbuf);

当客户端使用headerAccept: text/plain时,服务器没有发送响应,但是在header值更改为[=11]后return响应=].