httparty icon indicating copy to clipboard operation
httparty copied to clipboard

Please specify in documentation to convert body in json

Open stefanosalvucci opened this issue 3 years ago • 1 comments

I've spent one hour figuring out how to proper send a POST request, ended up on https://stackoverflow.com/questions/7455744/post-json-to-api-using-rails-and-httparty which helped me a lot in adding .to_json to the body hash

@result = HTTParty.post(@urlstring_to_post.to_str, :body => { :subject => 'This is the screen name', :issue_type => 'Application Problem', :status => 'Open', :priority => 'Normal', :description => 'This is the description for the problem' }.to_json, :headers => { 'Content-Type' => 'application/json' } )

stefanosalvucci avatar Dec 03 '21 14:12 stefanosalvucci

This is probably common enough that it could be detailed in the docs. @jnunemaker could you review https://github.com/jnunemaker/httparty/pull/765 please?

JonMidhir avatar Oct 07 '22 23:10 JonMidhir

Merged the documentation update for this.

jnunemaker avatar Nov 03 '22 20:11 jnunemaker