ps7_ga
Last Updated: February 25, 2016
·
1.632K
· nick-desteffen

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)

1 Response
Add your response

15985

Thank you very much, you saved the other half of my day.

over 1 year ago ·