I am new to Ruby on Rails, I would like to pass some data to my other application. I am currently using httpparty
gem but I am having a hard time when I send big data such as text so I was wondering if there is any recommended gem that converts plain html text to
the format that I can send through or easy way to do
What I am trying to do:
e.g:
def abc_action
contents = params[:content]
response = HTTParty.post("http://abc.go.com?contents=#{contents}")
end
say content params include many paragraphs such as
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"
Thanks for your help.
URI.encode("Hello world &")
. After sending the payload you can decode this withURI.decode("Hello%20world%20&")
. All special characters will be untouched - nuakyHTTParty
will handle this for you when used appropriately. tryHTTParty.post("http://abc.go.com",body: {contents: params[:content]})
instead. HTTParty::post. If it must be appended to the URL which seesm odd for a POST request then access would be as follows:HTTParty.post("http://abc.go.com",query: {contents: params[:content]})
- engineersmnky