summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--test/test-oauth-consumer.cc18
1 files changed, 4 insertions, 14 deletions
diff --git a/test/test-oauth-consumer.cc b/test/test-oauth-consumer.cc
index 3b3ca70..c5a0fc0 100644
--- a/test/test-oauth-consumer.cc
+++ b/test/test-oauth-consumer.cc
@@ -37,34 +37,24 @@ int main(int,char**) {
test.set_field("foo","bar");
opkele::util::curl_pick_t curl = opkele::util::curl_t::easy_init();
opkele::oauth::http_request_t hr("POST",
"http://term.ie/oauth/example/echo_api.php");
sc.prepare_request(hr,
opkele::fields_t(),test,
opkele::oauth::oauth_auth_header,"HMAC-SHA1",
&at,"realm");
- DOUT_("url: " << hr.url << endl
- << "body: " << hr.body << endl
- << "header: " << hr.authorize_header);
- opkele::util::curl_slist_t rh;
- rh.append("Authorization: "+hr.authorize_header);
- CURLcode r;
- (r=curl.misc_sets())
- || (r=curl.set_write())
- || (r=curl.easy_setopt(CURLOPT_HTTPHEADER,rh) )
- || (r=curl.easy_setopt(CURLOPT_URL,hr.url.c_str()))
- || (r=curl.easy_setopt(CURLOPT_POST,1))
- || (r=curl.easy_setopt(CURLOPT_POSTFIELDS,hr.body.c_str()))
- || (r=curl.easy_setopt(CURLOPT_POSTFIELDSIZE,hr.body.size()));
+ CURLcode r = curl.misc_sets();
+ r || (r=curl.set_write());
if(r)
throw opkele::exception_curl(OPKELE_CP_ "failed to set curly options",r);
+ hr.setup_curl(curl);
if( (r=curl.easy_perform()) )
throw opkele::exception_curl(OPKELE_CP_ "failed to perform curly request",r);
- DOUT_("Response: " << endl << curl.response);
+ cout << "Response: " << curl.response << endl;
#ifdef OPKELE_HAVE_KONFORKA
}catch(konforka::exception& e) {
cerr
<< "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl
<< " what: " << e.what() << endl
<< " where: " << e.where() << endl;
if(!e._seen.empty()) {