开发者

Net::HTTP post with multiline param

开发者 https://www.devze.com 2023-03-25 16:06 出处:网络
I\'d like to post a multiline param with Net::HTTP in Ruby. I tried adding \\n or \\r\\n in the param string but it just arrives at destination as \\n or \\r\\n.

I'd like to post a multiline param with Net::HTTP in Ruby. I tried adding \n or \r\n in the param string but it just arrives at destination as \n or \r\n.

Net::HTTP开发者_JAVA百科.post_form(URI.parse('http://mysite.com/post/uri'),{'param'=>'value','multiline_data'=>'data_line1\ndata_line2'})

How can I achieve that?


Line feeds in URL's are usually encoded as %0D%0A. You need to break your sentences using this to receive a multi line input on the other end.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号