Releases: shortcut/NetworkKit
Releases · shortcut/NetworkKit
Data in data even if server responds with 0 bytes
Empty data as success
Allow the server to response with empty data
Disk request fixes, cancellation fixes, logging improvement
Merge pull request #26 from shortcut/diskRequestFixes Disk request fixes, cancellation fixes, logging improvement
0.1.5: Bug fix
Fixed retain cycle on requests
0.1.4: Validation and custom error parsing
- add better validation of requests
- be able to specify a model type for error responses
(details in README)
bux fixes
Add RequestAdapter
New protocol for adding adapters (middleware) to a request:
public protocol RequestAdapter {
func adapt(_ urlRequest: URLRequest) -> URLRequest
}
Request
now has adapters: [RequestAdapter]
and func withAdapter(_ adapter: RequestAdapter) -> Self
which you can use to chain the addition of adapters
Example:
network.request(OrderAPI.getOrders)
.withAdapter(AuthenticationAdapter(accessToken: accessToken))
.responseDecoded(of: OrderResponse.self)
Fixes DiskRequest and adds TargetType properties for mock data
TargetType protocol now includes:
var diskPath: String? { get } // for mocks using DiskRequest
var diskDelay: TimeInterval { get }
in order for a target to define a local json file for the request, and an optional delay (to test loading UI for example)
New Network API
This release introduces an almost complete rewrite of the API. See README for more info
0.0.3: Merge pull request #11 from shortcut/andre/queryOptions
add ability to configure query string format for arrays and dictionaries