fixes the function signature of set_method
#ifndef HTTP_COMMON_H_
#define HTTP_COMMON_H_
+#include <curl/curl.h>
/* UTILITY MACROS */
#define STREQ(str1, str2) (0 == strcmp(str1, str2))
@@ -93,33 +94,33 @@ http_code_print(enum http_code code)
/* set specific http method used for the request */
static void
-set_method(struct discord_api_s *api, enum http_method method, char postfields[])
+set_method(CURL *ehandle, enum http_method method, char postfields[])
{
CURLcode ecode;
switch (method) {
case DELETE:
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_CUSTOMREQUEST, "DELETE");
+ ecode = curl_easy_setopt(ehandle, CURLOPT_CUSTOMREQUEST, "DELETE");
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
break;
case GET:
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_HTTPGET, 1L);
+ ecode = curl_easy_setopt(ehandle, CURLOPT_HTTPGET, 1L);
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
break;
case POST:
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_POST, 1L);
+ ecode = curl_easy_setopt(ehandle, CURLOPT_POST, 1L);
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
//set ptr to payload that will be sent via POST/PUT
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_POSTFIELDS, postfields);
+ ecode = curl_easy_setopt(ehandle, CURLOPT_POSTFIELDS, postfields);
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
break;
case PATCH:
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_CUSTOMREQUEST, "PATCH");
+ ecode = curl_easy_setopt(ehandle, CURLOPT_CUSTOMREQUEST, "PATCH");
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
break;
case PUT:
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_UPLOAD, 1L);
+ ecode = curl_easy_setopt(ehandle, CURLOPT_UPLOAD, 1L);
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
- ecode = curl_easy_setopt(api->ehandle, CURLOPT_POSTFIELDS, postfields);
+ ecode = curl_easy_setopt(ehandle, CURLOPT_POSTFIELDS, postfields);
ASSERT_S(CURLE_OK == ecode, curl_easy_strerror(ecode));
break;
default:
