[英]how do I use curl to test my Rails controller create action.. or can I use rspec?
Please bear with me as the Rails guide chooses to not even mention the create action in their API section. 请耐心等待,因为Rails指南选择在其API部分中甚至不提及create操作。 My goal is to build a RESTFUL API from which content can be created. 我的目标是建立一个RESTFUL API,从中可以创建内容。 Here is what the form looks like after $ curl myapp
这是$ curl myapp
之后的形式
<form class="new_blog" id="new_blog" action="/blog" accept-charset="UTF-8" data-remote="true" method="post"><input name="utf8" type="hidden" value="✓" />
<label for="blog_input">Input a String</label>
<textarea class="input-field" name="blog[input]" id="blog_input">
</textarea>
<input type="submit" name="commit" value="Create Blog" />
</form>
I want to POST content through curl... or... can I test this somehow through Rspec? 我想通过curl来发布内容...还是...我可以通过Rspec以某种方式对其进行测试吗?
The goal is that I have a RESTFUL API that allows content to be created through HTTP requests and then gives an HTTP response. 我的目标是拥有一个RESTFUL API,该API允许通过HTTP请求创建内容,然后给出HTTP响应。
您可以使用Ruby HTTP Cheat Sheet并直接从Ruby创建各种类型的请求,而无需为此做任何准备。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.