在请求处理程序中,处理例如GET
https://example.com/collections/1或 POSThttp://0.0.0.0:8080/collections
我如何分别获取服务器地址https://example.com和http://0.0.0.0:8080?
目前我正在像这样构建它
var url = "\(httpPrefix)\(server.serverAddress)"
if server.serverPort != 443 { url += ":\(server.serverPort)" }
哪里httpPrefix
是:
let httpPrefix = isLinux ? "https://" : "http://"
但感觉有更好的方法...