使用curl使用摘要测试基本的http认证

Ami*_*tel 6 authentication curl ruby-on-rails basic-authentication ruby-on-rails-3

我们如何测试认证与消化的解释这里使用curl?

我能够测试简单的基本设置例如AuthorizationBasic {SECRET}哪里SECRETBase64::encode64("username:password")为解释在这里

我尝试发送Authentication具有相同值的标头但是NoMethodError (undefined method 'unpack' for nil:NilClass)在线呼叫authenticate_or_request_with_http_digest

请问有谁能解释我在这里做错了什么?

Ami*_*tel 18

最后,我能够解决问题.以下是我使用curl来测试带有摘要的http基本身份验证的方法

curl --data {"red":"00"} --digest -u "username:password" "http://localhost:3000/api/statistics"
Run Code Online (Sandbox Code Playgroud)