In request handler, processing e.g. GET
https://example.com/collections/1 or POSThttp://0.0.0.0:8080/collections
how do I get server address https://example.com and http://0.0.0.0:8080 respectively?
Currently I'm constructing it like so
var url = "\(httpPrefix)\(server.serverAddress)"
if server.serverPort != 443 { url += ":\(server.serverPort)" }
where httpPrefix
is:
let httpPrefix = isLinux ? "https://" : "http://"
But it feels like there's a better way...