我已经创建了一个rails-api应用程序并继续使用令牌认证来保护它.
我设置了一个before_filter调用使用的方法authenticate_or_request_with_http_token.一切正常,但是,当身份验证不正确时,我得到一个HTML响应.
如何定义响应的格式?
before_filter :restrict_access
private
def restrict_access
authenticate_or_request_with_http_token do |token, options|
check_token token
end
end
def check_token(token)
Session.exists?(access_token: token)
end
Run Code Online (Sandbox Code Playgroud) 我正在做一个小玩具项目来测试Yeoman和棱角分明.
创建应用程序后,yo angular我开始编写服务及其测试.在我试图忽略测试之前,一切都很完美.
从我读过,我应该能够忽略测试改变it到xit和适应变化describe来xdescribe.
但是,当我保存和咕噜启动测试,我得到一个'xit' is not defined或'xdescribe' is not defined错误.
有什么我想念的吗?
我需要模拟一个休息服务,该模拟已经在 SoapUI 上运行了。问题是我创建了一个带有这样的 URL 的模拟/test/userA/。
有没有办法创建一个也能响应 url 的模拟/test/userB/?我在想类似/test/user?/或 的东西test/user[A-Z]/。用 SoapUI 可以吗?