Update pull according to comments
This commit is contained in:
parent
25c2edda35
commit
662010fc0f
|
|
@ -24,10 +24,9 @@ import Foundation
|
|||
|
||||
extension String {
|
||||
|
||||
/**
|
||||
Extracts host from strings that can be converted to URL.
|
||||
Causes assertionFailure if string cannot be converted.
|
||||
*/
|
||||
/// Extracts host from strings that can be converted to URL.
|
||||
/// Causes assertionFailure if string cannot be converted.
|
||||
|
||||
var asHost: String {
|
||||
guard let host = URL(string: self)?.host else {
|
||||
assertionFailure("Cannot detect host for base URL")
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ public struct NetworkServiceConfiguration {
|
|||
sessionConfiguration.timeoutIntervalForResource = timeoutInterval
|
||||
sessionConfiguration.httpAdditionalHeaders = additionalHttpHeaders
|
||||
|
||||
var updatedPolicies: [String: ServerTrustPolicy] = [:]
|
||||
trustPolicies.forEach { updatedPolicies[$0.key.asHost] = $0.value }
|
||||
let updatedPolicies = Dictionary(uniqueKeysWithValues: trustPolicies.map { ($0.key.asHost, $0.value) })
|
||||
serverTrustPolicies = trustPolicies.isEmpty ? [baseUrl.asHost: .disableEvaluation] : updatedPolicies
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue