GNOME Bugzilla – Bug 704105
Hard to access SoupMessageBody with introspection
Last modified: 2013-11-17 14:49:43 UTC
It is hard to use SugarMessageBody with introspection, e.g. from python. The data itself is exposed in the struct: typedef struct { const char *data; goffset length; } SoupMessageBody; However there is currently no way to produce an annotation for this that says "data is a byte array with length length". Instead data is interpreted as a NULL-terminated string, which is wrong. I believe the norm here would be to provide an API to get at the data. There is actually a way of doing that, so maybe this bug could be closed simply by mentioning it in the documentation: call soup_message_body_flatten() to convert the body into a SoupBuffer then use soup_buffer_get_as_bytes().
hm... we could add GBytes-valued properties to SoupMessage too, and save a few steps. "request-body-data" and "response-body-data" perhaps
added GBytes-valued request_body_data and response_body_data properties