Setting the request body of a RestProxyCall


I am trying to set the request body of a RestProxyCall. Is there a way to do this?


My thoughts on this are twofold. If this facility does not exist, I can submit a Merge Request that will allow two methods:

  • Method one: Accepts a string, and a content-type. This will be wrapped in a SoupMessage and sent as part of the request

  • Method two: Accepts a SoupMessage that will be passed directly to the request.

For reasons that are slightly beyond my control (namely distribution related ones) I am currently limited to librest-0.7 and librest-0.8.

Hi Clifton,

already mailed you my answer but for completion and other parties i paste my answer here too:

In what kind do you need to control the request body? Librest basically abstracts this away in 2 ways. You can add RestParam’s via Rest.ProxyCall.add_param and depending on the Method it will be serialized as query (GET) or as body (POST). If you need to send json then you have the possibility to subclass ProxyCall and overwrite the serialize_params vfunc. With that you can control completly what content-type or content you want to send.

Best regards


Thanks for your response. Oddly enough, I never got the email. I hope it is sitting in limbo somewhere, awaiting delivery.

You are correct, I need to send a JSON object via POST. So I will look into subclassing ProxyCall.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.