Ruby on rails 401如果通过自定义故障应用程序发送,则未经授权的响应在ios中为空 class CustomFailureApp
当用户未经确认时,spree_auth_design respond with unauthorized由我的自定义故障应用程序处理,但ios应用程序收到的响应对象为空。 ios应用程序正在使用AFNetworking,并已更新为最新版本Ruby on rails 401如果通过自定义故障应用程序发送,则未经授权的响应在ios中为空 class CustomFailureApp,ruby-on-rails,ruby,spree-auth-devise,Ruby On Rails,Ruby,Spree Auth Devise,当用户未经确认时,spree_auth_design respond with unauthorized由我的自定义故障应用程序处理,但ios应用程序收到的响应对象为空。 ios应用程序正在使用AFNetworking,并已更新为最新版本 我无法理解我做错了什么。我发现这段代码没有任何错误,相反,ios响应处理程序有错误 class CustomFailureApp < Devise::FailureApp # You need to override respond to elimina
我无法理解我做错了什么。我发现这段代码没有任何错误,相反,ios响应处理程序有错误
class CustomFailureApp < Devise::FailureApp
# You need to override respond to eliminate recall
def respond
if http_auth?
http_auth
else
if request.format == "application/json"
self.status = 401
self.content_type = "json"
self.headers['WWW-Authenticate']="Please Confirm Your Account To Continue"
self.response_body = {error: I18n.t("devise.failure.inactive")}.to_json
else
redirect
end
end
end
end