デバッグ出力、鎮まり給え(#64)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <cocoatweet/api/favorite/create.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
Create::Create() {
|
||||
contentType_ = "application/x-www-form-urlencoded";
|
||||
@@ -12,7 +12,6 @@ void Create::id(const std::string& _id) {
|
||||
|
||||
void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
HttpPost::process(_oauth, [](const unsigned int _, const std::string& _srv) {
|
||||
std::cout << _srv << std::endl;
|
||||
});
|
||||
}
|
||||
} // namespace CocoaTweet::API::Favorites
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <cocoatweet/api/favorite/destroy.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
Destroy::Destroy() {
|
||||
contentType_ = "application/x-www-form-urlencoded";
|
||||
@@ -12,7 +12,6 @@ void Destroy::id(const std::string& _id) {
|
||||
|
||||
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
HttpPost::process(_oauth, [](const unsigned int _, const std::string& _srv) {
|
||||
std::cout << _srv << std::endl;
|
||||
});
|
||||
}
|
||||
} // namespace CocoaTweet::API::Favorites
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "cocoatweet/api/favorite/favorite.h"
|
||||
#include "cocoatweet/api/favorite/create.h"
|
||||
#include "cocoatweet/api/favorite/destroy.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
extern "C" {
|
||||
#include <curl/curl.h>
|
||||
}
|
||||
@@ -31,7 +31,6 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
auto signature = oauth->signature(sigingParam, "POST", url_);
|
||||
|
||||
// 作成した署名をエンドポイントへのパラメータ及びOAuthパラメータに登録
|
||||
std::cout << "signature : " << signature["oauth_signature"] << std::endl;
|
||||
oauthParam.merge(signature);
|
||||
|
||||
// リクエストボディの構築
|
||||
@@ -43,7 +42,6 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
}
|
||||
requestBody = CocoaTweet::Util::join(tmp, "&");
|
||||
}
|
||||
std::cout << "request Body -> " << requestBody << std::endl;
|
||||
|
||||
// ヘッダの構築
|
||||
std::string oauthHeader = "authorization: OAuth ";
|
||||
@@ -54,7 +52,6 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
}
|
||||
oauthHeader += CocoaTweet::Util::join(tmp, ",");
|
||||
}
|
||||
std::cout << "OAuth Header -> " << oauthHeader << std::endl;
|
||||
|
||||
// do post
|
||||
CURL* curl;
|
||||
@@ -63,7 +60,6 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
long responseCode;
|
||||
curl = curl_easy_init();
|
||||
url_ = url_;
|
||||
std::cout << "URL : " << url_ << std::endl;
|
||||
if (curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url_.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
@@ -71,7 +67,9 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, requestBody.length());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlCallback_);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (std::string*)&rcv);
|
||||
#ifndef NDEBUG
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
#endif
|
||||
// Headerを保持するcurl_slist*を初期化
|
||||
struct curl_slist* headers = NULL;
|
||||
// Authorizationをヘッダに追加
|
||||
@@ -83,7 +81,7 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
}
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
std::cout << "curl error : " << res << std::endl;
|
||||
throw std::runtime_error(std::string("INTERNAL ERROR : curl(") + std::to_string(res) + ")");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <cocoatweet/exception/rateLimitException.h>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Model {
|
||||
Tweet Tweet::parse(const unsigned int _responseCode, const std::string& _json) {
|
||||
auto j = nlohmann::json::parse(_json);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "cocoatweet/api/status/destroy.h"
|
||||
#include <cocoatweet/api/model/tweet.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
Destroy::Destroy() {}
|
||||
void Destroy::id(const std::string _id) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "cocoatweet/api/status/status.h"
|
||||
#include "cocoatweet/api/status/update.h"
|
||||
#include "cocoatweet/api/status/destroy.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "cocoatweet/api/status/update.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
Update::Update() {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
|
||||
extern "C" {
|
||||
#include <openssl/hmac.h>
|
||||
@@ -26,7 +25,6 @@ std::map<std::string, std::string> OAuth1::signature(
|
||||
std::vector<std::string> tmp;
|
||||
for (const auto& [key, value] : _param) {
|
||||
tmp.push_back(key + "=" + value);
|
||||
std::cout << (key + "=" + value) << std::endl;
|
||||
}
|
||||
|
||||
std::string query = CocoaTweet::Util::join(tmp, "&");
|
||||
@@ -36,10 +34,6 @@ std::map<std::string, std::string> OAuth1::signature(
|
||||
CocoaTweet::Util::urlEncode(query);
|
||||
auto k64Sha1 = hmacSha1(significateKey, significateBase);
|
||||
|
||||
std::cout << "significate key : " << significateKey << std::endl;
|
||||
std::cout << "significate base : " << significateBase << std::endl;
|
||||
std::cout << "hmac-sha1 : " << k64Sha1 << std::endl;
|
||||
|
||||
auto ret = std::map<std::string, std::string>{{"oauth_signature", k64Sha1}};
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user