aboutsummaryrefslogtreecommitdiff
path: root/xs_curl.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-02-17 08:13:39 +0100
committerdefault <nobody@localhost>2025-02-17 08:13:39 +0100
commit349d6603e4cd4a8baff1db718afa83413b0dae5f (patch)
tree13fe0fa89900d24993ce0ee3d8ceb77415652146 /xs_curl.h
parent3844bbf04f9b417ee9fc97f6f43db259a063a1da (diff)
Show the POST status also as string.
Diffstat (limited to 'xs_curl.h')
-rw-r--r--xs_curl.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/xs_curl.h b/xs_curl.h
index f0cfd98..657644a 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -9,6 +9,8 @@ xs_dict *xs_http_request(const char *method, const char *url,
const xs_str *body, int b_size, int *status,
xs_str **payload, int *p_size, int timeout);
+const char *xs_curl_strerr(int errnum);
+
#ifdef XS_IMPLEMENTATION
#include <curl/curl.h>
@@ -194,6 +196,15 @@ xs_dict *xs_http_request(const char *method, const char *url,
return response;
}
+
+const char *xs_curl_strerr(int errnum)
+{
+ CURLcode cc = errnum < 0 ? -errnum : errnum;
+
+ return curl_easy_strerror(cc);
+}
+
+
#endif /* XS_IMPLEMENTATION */
#endif /* _XS_CURL_H */