如何使用open-uri发出POST请求? [英] How do I make a POST request with open-uri?

查看:136
本文介绍了如何使用open-uri发出POST请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用open-uri从Ruby发出POST请求?

Is it possible to make a POST request from Ruby with open-uri?

推荐答案

不幸的是,open-uri仅支持GET动词.

Unfortunately open-uri only supports the GET verb.

您可以放下一个级别并使用net/http,也可以使用设计为支持POST和其他动词的rest-open-uri.您可以执行gem install rest-open-uri进行安装.

You can either drop down a level and use net/http, or use rest-open-uri, which was designed to support POST and other verbs. You can do gem install rest-open-uri to install it.

这篇关于如何使用open-uri发出POST请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆