-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Description
After some debugging I've found that the headers setter is calling the getter which calls a dynamic getter and ignores the new values
This declaration
open var headers : [String: String]? {
get { return socket.request.allHTTPHeaderFields }
set {
for (field, value) in headers ?? [:] {
socket.request.setValue(value, forHTTPHeaderField: field)
}
}
}
Should be replaced with this
open var headers : [String: String]? {
get { return socket.request.allHTTPHeaderFields }
set {
for (field, value) in newValue ?? [:] {
socket.request.setValue(value, forHTTPHeaderField: field)
}
}
}
If you need a test just run this example
let client: ActionCableClient = {
let _client = ActionCableClient(url: Defaults.Api.cableURL)
_client.headers = [
"Origin": "https://server.example"
]
return _client
}()
print(client.headers)
client.headers = [
"Origin": "https://server.example",
"Accept": "accept/json"
]
print(client.headers)
if !client.isConnected {
client.connect()
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels