gpt4 book ai didi

ruby-on-rails - 这个设计配置有什么作用?

转载 作者:行者123 更新时间:2023-12-04 00:38:52 24 4
gpt4 key购买 nike

我想将设计限制为来自互联网的 api 上的 json 请求。它有什么作用?

# config/initializers/devise.rb

config.http_authenticatable_on_xhr = false
config.navigational_formats = ["*/", :html, :json]

最佳答案

从设计文档,

config.http_authenticable_on_xhr = true

If http headers should be returned for AJAX requests. True by default.

config.navigational_formats = ["/", :html, :json]
==> Navigation configuration
Lists the formats that should be treated as navigational. Formats like
:html, should redirect to the sign in page when the user does not have
access, but formats like :xml or :json, should return 401.

If you have any extra navigational formats, like :iphone or :mobile, you
should add them to the navigational formats lists.

The :"*/*" and "*/*" formats below is required to match Internet
Explorer requests.

关于ruby-on-rails - 这个设计配置有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21731631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com