具有多行参数的 Net::HTTP post
我想在 Ruby 中使用 Net::HTTP 发布多行参数。我尝试在参数字符串中添加 \n 或 \r\n 但它只是以 \n 或 \r\n 形式到达目的地。
Net::HTTP.post_form(URI.parse('http://mysite.com/post/uri'),{'param'=>'value','multiline_data'=>'data_line1\ndata_line2'})
我怎样才能做到这一点?
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.post_form(URI.parse('http://mysite.com/post/uri'),{'param'=>'value','multiline_data'=>'data_line1\ndata_line2'})
How can I achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
URL 中的换行符通常编码为 %0D%0A。您需要使用它来中断句子以在另一端接收多行输入。
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.