Releases: freshOS/Networking
Releases · freshOS/Networking
Adds PrivacyInfo.xcprivacy
2.0.2-beta
Replaces POST PUT PATCH params
by body
parameter with an enum (.urlEncode
| .json
| .multipart
)
1.2.4
1.2.1
1.2.0
Adds jsonDecoderFactory
to provide your own JSONDecoder
.
network.jsonDecoderFactory = {
let decoder = JSONDecoder()
let df = DateFormatter()
df.locale = Locale(identifier: "en_US_POSIX")
df.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
decoder.dateDecodingStrategy = .formatted(df)
return decoder
}
1.1.1
1.1.0
1.0.0
0.3.5
0.3.4
- Solves #26
- Add the ability to retry a request with a middleWare via
requestRetrier
The typical example use case is reauthenticating before retrying a request:
private var isRetrying = CurrentValueSubject<Bool, Error>(false)
init() {
restAPI.network.requestRetrier = { [unowned self] _, error in
if self.isRetrying.value == true {
return self.isRetrying.filter({ !$0 }).asVoid().eraseToAnyPublisher()
}
guard let error = error as? NetworkingError, error.status == .unauthorized else {
return nil
}
return restAPI.authenticate().eraseToAnyPublisher()
}
}
Thanks @denis-obukhov for this improvement !