Proper Typhoeus PUT request
Submitting a PUT request with Typhoeus is a bit different than a POST request. You need to explicitly set the content-type header in order for the parameters specified in the body to be properly parsed by Rails
parameters = {user: {email: 'user@example.com', name: 'Example User'}}
headers = {"content-type" => "application/x-www-form-urlencoded"}
Typhoeus::Request.put("example.com/api/users/99", body: parameters, headers: headers)
Written by Nick DeSteffen
Related protips
1 Response
Thank you very much, you saved the other half of my day.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#