gpt4 book ai didi

ruby-on-rails - 如何让 redirect_ 使用不同的 HTTP 请求?

转载 作者:行者123 更新时间:2023-12-04 01:03:30 24 4
gpt4 key购买 nike

在我的 Controller 操作之一结束时,我需要重定向到仅接受放置请求的页面。我一直在试图弄清楚如何让 redirect_to 使用放置请求,但没有成功。

这可能吗?还是有另一种方法来实现这一目标?

最佳答案

我认为您无法做到这一点,我怀疑限制是 HTTP 本身的一部分。

使用时重定向到 - 重定向作为“302 Moved” header 发生,除非参数中另有说明。

查看 HTTP 规范本身并没有揭示任何更改浏览器通过重定向发出的请求类型的方法。

HTTP Redirects :

This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD.



我认为您可能需要使用 JavaScript 来实现此功能,或者可能需要重新考虑应用程序中的控制流程。

关于ruby-on-rails - 如何让 redirect_ 使用不同的 HTTP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/670250/

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