How to set --data-binary and --compressed in Curb gem

443 Views Asked by At

I'd like to set --data-binary and --compressed options. In curl:

curl 'http://test.url' --data-binary test_json --compressed

How do I set --data-binary and --compressed options in curb?

1

There are 1 best solutions below

0
On

Maybe this will work:

ce = Curl::Easy.new("http://test.url")
ce.encoding = 'gzip'
ce.multipart_form_post = true
fields = [
  Curl::PostField.file('foo', foo_file_path),
  Curl::PostField.file('bar', bar_file_path)
]
curl.http_post(fields)
ce.perform

the response body is in ce.body_str