Getting a Binary Reponse using Curb

Hi guys,

I am new to ruby. I have the following problem.

I have a rendering engine that will take a svg and a set of params and
return a PNG image.

If I use curl on the command line passing the SVG it returns the image
as PNG and everything looks good.

I am trying to issue the same command using CURB but I have no idea how
to get the binary body.

I tried the following code:

      def get_product_image_curl(svg, image_name, w, h, region,
          preview_url =

      c =
      svg = URI.escape(svg,"[^#{URI::PATTERN::UNRESERVED}]"))
      c.http_post(Curl::PostField.content('design', svg,

      return c.body_str

The body returns empty

The curls that works (same svg)
curl -v --data-urlencode design@472712874.svg "http://<render


Any idea how to get the body our of the response?

Thanks in advance
Dalmer Azevedo