[librest] proxy-call: prevent message form if no params available



commit d08c6df432caadf68e3c0b6942ade8d3de3bde51
Author: Günther Wagner <info gunibert de>
Date:   Tue Feb 1 21:25:58 2022 +0100

    proxy-call: prevent message form if no params available

 rest/rest-proxy-call.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index 791a7dd..6da13ca 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -891,13 +891,19 @@ prepare_message (RestProxyCall *call, GError **error_out)
     hash = rest_params_as_string_hash_table (priv->params);
 
 #ifdef WITH_SOUP_2
-    message = soup_form_request_new_from_hash (priv->method,
-                                               priv->url,
-                                               hash);
+    if (g_hash_table_size (hash) == 0)
+      message = soup_message_new (priv->method, priv->url);
+    else
+      message = soup_form_request_new_from_hash (priv->method,
+                                                 priv->url,
+                                                 hash);
 #else
-    message = soup_message_new_from_encoded_form (priv->method,
-                                                  priv->url,
-                                                  soup_form_encode_hash (hash));
+    if (g_hash_table_size (hash) == 0)
+      message = soup_message_new (priv->method, priv->url);
+    else
+      message = soup_message_new_from_encoded_form (priv->method,
+                                                    priv->url,
+                                                    soup_form_encode_hash (hash));
 #endif
 
     g_hash_table_unref (hash);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]