Skip to content

Commit cc7d96e

Browse files
committed
remove trailing / from urls
1 parent bf11044 commit cc7d96e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Source/SocketIOClient.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
6262
public init(socketURL: String, options: Set<SocketIOClientOption> = []) {
6363
self.options = options
6464

65-
if socketURL["https://"].matches().count != 0 {
65+
if socketURL.hasPrefix("https://") {
6666
self.options.insertIgnore(.Secure(true))
6767
}
68+
69+
var cleanedURL = socketURL["https?://"] <~ ""
70+
71+
if cleanedURL.hasSuffix("/") {
72+
cleanedURL = String(cleanedURL.characters.dropLast())
73+
}
6874

69-
self.socketURL = socketURL["https?://"] <~ ""
75+
self.socketURL = cleanedURL
7076

7177
for option in options {
7278
switch option {

0 commit comments

Comments
 (0)