Ruby https post file




















The problem it was a json. This solve my problem. Anyway, my question was not clear, so the bounty goes to Juri. If you just want to get the response and throw other objects away this is quite useful. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 6 months ago.

Active 4 years, 2 months ago. Viewed 70k times. How can I make a Https post with a header in Ruby with a json? Tags: file , http , post , ruby. December 31, Ruby Leave a comment. Why am I getting this and how can I get around it? Questions: The following line is working fine in ruby 1. What alternative I can use in 1. Add menu. So I guess I just have to take all the credit for myself… The module I wrote for this contains one public class, for generating the form data and headers out of a hash of String and File objects.

I only tested this in ruby 2. It's not a problem with Authorization or the other headers. I think the problem lies with translating --data-binary to Ruby. Technique 1: the payload includes a field or parameter named 'upload' and the value is set to the image object. Note that I didn't include the 'Content-Length' header; this is not usually required when using RestClient because it inserts it for you when processing files. There is another way to send payloads with RestClient explained here.

Make sure to read through the official docs on github as well. I am also new to RestClient so if I'm wrong in this case don't be too harsh; I will correct any misconceptions of mine immediately.

Hope this helps! Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 7 months ago. Active 1 year, 7 months ago. Viewed 9k times.



0コメント

  • 1000 / 1000