ps7_ga
Last Updated: February 25, 2016
·
1.571K
· nick-desteffen
Img 2817

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)
Say Thanks
Respond

1 Response
Add your response

15985
34416e36bbe3383eb1e63eb6a5d714b6

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

over 1 year ago ·