summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rest/rest-proxy-call.c22
-rw-r--r--rest/rest-proxy-call.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index 2cb4990..3c4d222 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -1220,3 +1220,25 @@ rest_proxy_call_get_status_message (RestProxyCall *call)
return priv->status_message;
}
+
+RestXmlNode *
+rest_proxy_call_get_payload_as_xml (RestProxyCall *call)
+{
+ RestProxyCallPrivate *priv;
+ static RestXmlParser *parser = NULL;
+ RestXmlNode *root;
+
+ g_return_val_if_fail (REST_IS_PROXY_CALL (call), NULL);
+ priv = GET_PRIVATE (call);
+
+ if (parser == NULL)
+ parser = rest_xml_parser_new ();
+
+ root = rest_xml_parser_parse_from_data_full (parser,
+ priv->payload,
+ priv->length,
+ priv->url,
+ g_hash_table_lookup (priv->content_params, "charset"));
+
+ return root;
+}
diff --git a/rest/rest-proxy-call.h b/rest/rest-proxy-call.h
index 6f65914..13a5c03 100644
--- a/rest/rest-proxy-call.h
+++ b/rest/rest-proxy-call.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <rest/rest-params.h>
+#include <rest/rest-xml-parser.h>
G_BEGIN_DECLS
@@ -185,6 +186,8 @@ const gchar *rest_proxy_call_get_payload (RestProxyCall *call);
guint rest_proxy_call_get_status_code (RestProxyCall *call);
const gchar *rest_proxy_call_get_status_message (RestProxyCall *call);
+RestXmlNode *rest_proxy_call_get_payload_as_xml (RestProxyCall *call);
+
G_END_DECLS
#endif /* _REST_PROXY_CALL */