remove trailing / from urls

This commit is contained in:
Erik 2016-01-25 10:46:03 -05:00
parent bf1104443a
commit cc7d96e3d5

View File

@ -62,11 +62,17 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
public init(socketURL: String, options: Set<SocketIOClientOption> = []) {
self.options = options
if socketURL["https://"].matches().count != 0 {
if socketURL.hasPrefix("https://") {
self.options.insertIgnore(.Secure(true))
}
var cleanedURL = socketURL["https?://"] <~ ""
if cleanedURL.hasSuffix("/") {
cleanedURL = String(cleanedURL.characters.dropLast())
}
self.socketURL = socketURL["https?://"] <~ ""
self.socketURL = cleanedURL
for option in options {
switch option {