From b9d40e25c331a2cd317ac6555826b4d3ec646153 Mon Sep 17 00:00:00 2001 From: keita Date: Thu, 1 Apr 2021 21:51:20 +0900 Subject: [PATCH] =?UTF-8?q?dm=E3=82=92=E9=80=81=E4=BF=A1=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=81=AB=E3=81=AFapplication/json=E3=82=92po?= =?UTF-8?q?st=E3=81=97=E3=81=AA=E3=81=84=E3=81=A8=E3=81=84=E3=81=91?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81http/post=E3=81=AEinterface?= =?UTF-8?q?=E3=81=AB=E3=81=A6=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cocoatweet/api/interface/httpPost.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cocoatweet/api/interface/httpPost.cc b/src/cocoatweet/api/interface/httpPost.cc index 378c280..e9313a7 100644 --- a/src/cocoatweet/api/interface/httpPost.cc +++ b/src/cocoatweet/api/interface/httpPost.cc @@ -53,6 +53,8 @@ void HttpPost::process(std::weak_ptr _oauth, ("Content-Disposition: form-data; name=\"" + key + "\";\r\n\r\n" + value + "\r\n"); } requestBody += (std::string("--") + "milkcocoa0902" + "--" + "\r\n"); + }else if(contentType_ == "application/json"){ + requestBody = bodyParam_["data"]; } } @@ -95,6 +97,8 @@ void HttpPost::process(std::weak_ptr _oauth, contentType = contentType_; } else if (contentType_ == "multipart/form-data") { contentType = contentType_ + "; boundary=milkcocoa0902"; + }else if(contentType_ == "application/json"){ + contentType_ = "application/json"; } headers = curl_slist_append(headers, ("Content-Type: " + contentType).c_str());