gpt4 book ai didi

ios - 如何在完美框架中取消/删除使用服务器端 swift 重定向客户端

转载 作者:行者123 更新时间:2023-11-29 00:25:10 26 4
gpt4 key购买 nike

在我的服务器端 swift 演示中,我有重定向到客户端。它被永久地移动了。我怎样才能取消重定向。我使用下面的代码来重定向请求。

response.status = .movedPermanently
response.setHeader(.location, value: "http://www.perfect.org/")
response.completed()

现在我无法取消或不调用另一个函数。有什么方法可以删除重定向请求吗?

最佳答案

PerfectTemplate 项目:https://github.com/PerfectlySoft/PerfectTemplate.git已经证明了你的情况: https://github.com/PerfectlySoft/PerfectTemplate/blob/master/Sources/main.swift#L73

"routes":[
["method":"get", "uri":"/**",
"handler":PerfectHTTPServer.HTTPHandler.redirect,
"base":"http://localhost:\(port1)"]
]

这意味着对当前服务器的所有请求都将被转发到基本 url。

关于ios - 如何在完美框架中取消/删除使用服务器端 swift 重定向客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43223603/

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