ruby-on-rails - Rakismet - “空的“博客”价值”
问题描述
我正在尝试使用 httparty调用评论检查"Empty \"blog\" value"
,即使我在请求中传递了博客参数,我也会收到错误消息。下面是代码
url = "https://my_akistmet_key.rest.akismet.com/1.1/comment-check"
payload = {
:blog => "http://mysitename.com",
:comment_author => "Some Random User Name",
:comment_author_email => 'example_1@gmail.com',
:comment_content=> "Any comment",
:user_ip=> "A Valid user ip",
:user_agent=> "A Valid User agent",
:peramlink=> "A valid peramlink",
:comment_type=> 'comment'
}
response = HTTParty.post(url,
:body => payload.to_json,
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded'}
)
回复
#<HTTParty::Response:0x55db6da493d8 parsed_response="Missing required field: blog.", @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"server"=>["nginx"], "date"=>["Wed, 16 Dec 2020 06:20:37 GMT"], "content-type"=>["text/plain; charset=utf-8"], "content-length"=>["29"], "connection"=>["close"], "x-akismet-debug-help"=>["Empty \"blog\" value"]}>
response.body
=> "Missing required field: blog."
解决方案
推荐阅读
- ios - Xcode .aspectFill 在 iPad 和 iPhone X 上倾斜代码
- dart - 在 Flutter 中检测键盘事件
- javascript - 调用其他 2 个函数时未定义函数
- jenkins - 詹金斯您的反向代理设置似乎已损坏。
- cassandra - 副本数据中心的 Cassandra 目录设置
- sql-server - 为什么我的应用用户找不到始终加密的证书?
- javascript - AJAX 之后的 Kendo DropDownList 选择值
- amazon-web-services - 设置“maxActiveInstances”错误
- java - Android Studio 3.1.2 中的 Gradle 同步失败
- java - 用于 IntelliJ 多线程测试的 Java 工具