summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Wagner <info@gunibert.de>2022-02-01 21:25:58 +0100
committerGünther Wagner <info@gunibert.de>2022-02-01 22:18:07 +0100
commitd08c6df432caadf68e3c0b6942ade8d3de3bde51 (patch)
treee55fbb9c95868246af21c4d48aca51ce6b6c6b54
parent2ea3749366c3b139c0ffef8794458b3d347438eb (diff)
downloadlibrest-d08c6df432caadf68e3c0b6942ade8d3de3bde51.tar.gz
proxy-call: prevent message form if no params available
-rw-r--r--rest/rest-proxy-call.c18
1 files 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);