summaryrefslogtreecommitdiff
path: root/request.h
diff options
context:
space:
mode:
Diffstat (limited to 'request.h')
-rw-r--r--request.h21
1 files changed, 4 insertions, 17 deletions
diff --git a/request.h b/request.h
index 73b26d8..b65985c 100644
--- a/request.h
+++ b/request.h
@@ -86,34 +86,21 @@ inline void request(icclient_handler writefunction, void *writedata,
#ifdef __EMSCRIPTEN__
attr.onsuccess = writefunction;
+ if (writedata)
+ attr.userData = writedata;
+ strcpy(attr.requestMethod, "GET");
+ emscripten_fetch(&attr, url);
#else
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunction);
-#endif
if (writedata)
-#ifdef __EMSCRIPTEN__
- attr.userData = writedata;
-#else
curl_easy_setopt(curl, CURLOPT_WRITEDATA, writedata);
else
curl_easy_setopt(curl, CURLOPT_WRITEDATA, stdout);
-#endif
if (post)
-#ifdef __EMSCRIPTEN__
- strcpy(attr.requestMethod, "POST");
-#else
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
-#endif
else
-#ifdef __EMSCRIPTEN__
- strcpy(attr.requestMethod, "GET");
-#else
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
-#endif
-
-#ifdef __EMSCRIPTEN__
- emscripten_fetch(&attr, url);
-#else
#ifdef DEBUG
CURLcode res =
#endif