|
@@ -37,7 +37,7 @@ extension Request {
|
|
|
/// - Returns: The `StreamOf<Progress>`.
|
|
/// - Returns: The `StreamOf<Progress>`.
|
|
|
public func uploadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {
|
|
public func uploadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {
|
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
|
- uploadProgress(queue: .singleEventQueue) { progress in
|
|
|
|
|
|
|
+ uploadProgress(queue: underlyingQueue) { progress in
|
|
|
continuation.yield(progress)
|
|
continuation.yield(progress)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -50,7 +50,7 @@ extension Request {
|
|
|
/// - Returns: The `StreamOf<Progress>`.
|
|
/// - Returns: The `StreamOf<Progress>`.
|
|
|
public func downloadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {
|
|
public func downloadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {
|
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
|
- downloadProgress(queue: .singleEventQueue) { progress in
|
|
|
|
|
|
|
+ downloadProgress(queue: underlyingQueue) { progress in
|
|
|
continuation.yield(progress)
|
|
continuation.yield(progress)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -63,7 +63,7 @@ extension Request {
|
|
|
/// - Returns: The `StreamOf<URLRequest>`.
|
|
/// - Returns: The `StreamOf<URLRequest>`.
|
|
|
public func urlRequests(bufferingPolicy: StreamOf<URLRequest>.BufferingPolicy = .unbounded) -> StreamOf<URLRequest> {
|
|
public func urlRequests(bufferingPolicy: StreamOf<URLRequest>.BufferingPolicy = .unbounded) -> StreamOf<URLRequest> {
|
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
|
- onURLRequestCreation(on: .singleEventQueue) { request in
|
|
|
|
|
|
|
+ onURLRequestCreation(on: underlyingQueue) { request in
|
|
|
continuation.yield(request)
|
|
continuation.yield(request)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -76,7 +76,7 @@ extension Request {
|
|
|
/// - Returns: The `StreamOf<URLSessionTask>`.
|
|
/// - Returns: The `StreamOf<URLSessionTask>`.
|
|
|
public func urlSessionTasks(bufferingPolicy: StreamOf<URLSessionTask>.BufferingPolicy = .unbounded) -> StreamOf<URLSessionTask> {
|
|
public func urlSessionTasks(bufferingPolicy: StreamOf<URLSessionTask>.BufferingPolicy = .unbounded) -> StreamOf<URLSessionTask> {
|
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
|
- onURLSessionTaskCreation(on: .singleEventQueue) { task in
|
|
|
|
|
|
|
+ onURLSessionTaskCreation(on: underlyingQueue) { task in
|
|
|
continuation.yield(task)
|
|
continuation.yield(task)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -89,7 +89,7 @@ extension Request {
|
|
|
/// - Returns: The `StreamOf<String>`.
|
|
/// - Returns: The `StreamOf<String>`.
|
|
|
public func cURLDescriptions(bufferingPolicy: StreamOf<String>.BufferingPolicy = .unbounded) -> StreamOf<String> {
|
|
public func cURLDescriptions(bufferingPolicy: StreamOf<String>.BufferingPolicy = .unbounded) -> StreamOf<String> {
|
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in
|
|
|
- cURLDescription(on: .singleEventQueue) { description in
|
|
|
|
|
|
|
+ cURLDescription(on: underlyingQueue) { description in
|
|
|
continuation.yield(description)
|
|
continuation.yield(description)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -173,13 +173,13 @@ extension DataRequest {
|
|
|
/// - Parameters:
|
|
/// - Parameters:
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before completion.
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before completion.
|
|
|
/// - emptyResponseCodes: HTTP response codes for which empty responses are allowed. `[204, 205]` by default.
|
|
/// - emptyResponseCodes: HTTP response codes for which empty responses are allowed. `[204, 205]` by default.
|
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DataTask`.
|
|
/// - Returns: The `DataTask`.
|
|
|
- public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
|
|
|
emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
|
|
|
emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataTask<Data> {
|
|
emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataTask<Data> {
|
|
@@ -195,7 +195,7 @@ extension DataRequest {
|
|
|
/// - type: `Decodable` type to decode from response data.
|
|
/// - type: `Decodable` type to decode from response data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
|
/// `PassthroughPreprocessor()` by default.
|
|
/// `PassthroughPreprocessor()` by default.
|
|
|
/// - decoder: `DataDecoder` to use to decode the response. `JSONDecoder()` by default.
|
|
/// - decoder: `DataDecoder` to use to decode the response. `JSONDecoder()` by default.
|
|
@@ -204,7 +204,7 @@ extension DataRequest {
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DataTask`.
|
|
/// - Returns: The `DataTask`.
|
|
|
public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,
|
|
public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,
|
|
|
decoder: DataDecoder = JSONDecoder(),
|
|
decoder: DataDecoder = JSONDecoder(),
|
|
|
emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,
|
|
@@ -221,7 +221,7 @@ extension DataRequest {
|
|
|
/// - Parameters:
|
|
/// - Parameters:
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
|
/// `PassthroughPreprocessor()` by default.
|
|
/// `PassthroughPreprocessor()` by default.
|
|
|
/// - encoding: `String.Encoding` to use during serialization. Defaults to `nil`, in which case
|
|
/// - encoding: `String.Encoding` to use during serialization. Defaults to `nil`, in which case
|
|
@@ -231,7 +231,7 @@ extension DataRequest {
|
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DataTask`.
|
|
/// - Returns: The `DataTask`.
|
|
|
- public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
|
|
|
encoding: String.Encoding? = nil,
|
|
encoding: String.Encoding? = nil,
|
|
|
emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
|
|
@@ -249,16 +249,16 @@ extension DataRequest {
|
|
|
/// - serializer: `ResponseSerializer` responsible for serializing the request, response, and data.
|
|
/// - serializer: `ResponseSerializer` responsible for serializing the request, response, and data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DataTask`.
|
|
/// - Returns: The `DataTask`.
|
|
|
public func serializingResponse<Serializer: ResponseSerializer>(using serializer: Serializer,
|
|
public func serializingResponse<Serializer: ResponseSerializer>(using serializer: Serializer,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false)
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true)
|
|
|
-> DataTask<Serializer.SerializedObject> {
|
|
-> DataTask<Serializer.SerializedObject> {
|
|
|
- dataTask(automaticallyCancelling: shouldAutomaticallyCancel) {
|
|
|
|
|
- self.response(queue: .singleEventQueue,
|
|
|
|
|
- responseSerializer: serializer,
|
|
|
|
|
- completionHandler: $0)
|
|
|
|
|
|
|
+ dataTask(automaticallyCancelling: shouldAutomaticallyCancel) { [self] in
|
|
|
|
|
+ response(queue: underlyingQueue,
|
|
|
|
|
+ responseSerializer: serializer,
|
|
|
|
|
+ completionHandler: $0)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -269,16 +269,16 @@ extension DataRequest {
|
|
|
/// response, and data.
|
|
/// response, and data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DataTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DataTask`.
|
|
/// - Returns: The `DataTask`.
|
|
|
public func serializingResponse<Serializer: DataResponseSerializerProtocol>(using serializer: Serializer,
|
|
public func serializingResponse<Serializer: DataResponseSerializerProtocol>(using serializer: Serializer,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false)
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true)
|
|
|
-> DataTask<Serializer.SerializedObject> {
|
|
-> DataTask<Serializer.SerializedObject> {
|
|
|
- dataTask(automaticallyCancelling: shouldAutomaticallyCancel) {
|
|
|
|
|
- self.response(queue: .singleEventQueue,
|
|
|
|
|
- responseSerializer: serializer,
|
|
|
|
|
- completionHandler: $0)
|
|
|
|
|
|
|
+ dataTask(automaticallyCancelling: shouldAutomaticallyCancel) { [self] in
|
|
|
|
|
+ response(queue: underlyingQueue,
|
|
|
|
|
+ responseSerializer: serializer,
|
|
|
|
|
+ completionHandler: $0)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -366,13 +366,13 @@ extension DownloadRequest {
|
|
|
/// - Parameters:
|
|
/// - Parameters:
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before completion.
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before completion.
|
|
|
/// - emptyResponseCodes: HTTP response codes for which empty responses are allowed. `[204, 205]` by default.
|
|
/// - emptyResponseCodes: HTTP response codes for which empty responses are allowed. `[204, 205]` by default.
|
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
- public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
|
|
|
emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
|
|
|
emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadTask<Data> {
|
|
emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadTask<Data> {
|
|
@@ -390,7 +390,7 @@ extension DownloadRequest {
|
|
|
/// - type: `Decodable` type to decode from response data.
|
|
/// - type: `Decodable` type to decode from response data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the serializer.
|
|
|
/// `PassthroughPreprocessor()` by default.
|
|
/// `PassthroughPreprocessor()` by default.
|
|
|
/// - decoder: `DataDecoder` to use to decode the response. `JSONDecoder()` by default.
|
|
/// - decoder: `DataDecoder` to use to decode the response. `JSONDecoder()` by default.
|
|
@@ -399,7 +399,7 @@ extension DownloadRequest {
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,
|
|
public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,
|
|
|
decoder: DataDecoder = JSONDecoder(),
|
|
decoder: DataDecoder = JSONDecoder(),
|
|
|
emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,
|
|
@@ -416,10 +416,10 @@ extension DownloadRequest {
|
|
|
/// - Parameters:
|
|
/// - Parameters:
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
- public func serializingDownloadedFileURL(automaticallyCancelling shouldAutomaticallyCancel: Bool = false) -> DownloadTask<URL> {
|
|
|
|
|
|
|
+ public func serializingDownloadedFileURL(automaticallyCancelling shouldAutomaticallyCancel: Bool = true) -> DownloadTask<URL> {
|
|
|
serializingDownload(using: URLResponseSerializer(),
|
|
serializingDownload(using: URLResponseSerializer(),
|
|
|
automaticallyCancelling: shouldAutomaticallyCancel)
|
|
automaticallyCancelling: shouldAutomaticallyCancel)
|
|
|
}
|
|
}
|
|
@@ -429,7 +429,7 @@ extension DownloadRequest {
|
|
|
/// - Parameters:
|
|
/// - Parameters:
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the
|
|
/// - dataPreprocessor: `DataPreprocessor` which processes the received `Data` before calling the
|
|
|
/// serializer. `PassthroughPreprocessor()` by default.
|
|
/// serializer. `PassthroughPreprocessor()` by default.
|
|
|
/// - encoding: `String.Encoding` to use during serialization. Defaults to `nil`, in which case
|
|
/// - encoding: `String.Encoding` to use during serialization. Defaults to `nil`, in which case
|
|
@@ -439,7 +439,7 @@ extension DownloadRequest {
|
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
/// - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
- public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,
|
|
|
|
|
|
|
+ public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = true,
|
|
|
dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
|
|
dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
|
|
|
encoding: String.Encoding? = nil,
|
|
encoding: String.Encoding? = nil,
|
|
|
emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
|
|
emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
|
|
@@ -457,16 +457,16 @@ extension DownloadRequest {
|
|
|
/// - serializer: `ResponseSerializer` responsible for serializing the request, response, and data.
|
|
/// - serializer: `ResponseSerializer` responsible for serializing the request, response, and data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
public func serializingDownload<Serializer: ResponseSerializer>(using serializer: Serializer,
|
|
public func serializingDownload<Serializer: ResponseSerializer>(using serializer: Serializer,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false)
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true)
|
|
|
-> DownloadTask<Serializer.SerializedObject> {
|
|
-> DownloadTask<Serializer.SerializedObject> {
|
|
|
- downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) {
|
|
|
|
|
- self.response(queue: .singleEventQueue,
|
|
|
|
|
- responseSerializer: serializer,
|
|
|
|
|
- completionHandler: $0)
|
|
|
|
|
|
|
+ downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) { [self] in
|
|
|
|
|
+ response(queue: underlyingQueue,
|
|
|
|
|
+ responseSerializer: serializer,
|
|
|
|
|
+ completionHandler: $0)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -478,16 +478,16 @@ extension DownloadRequest {
|
|
|
/// response, and data.
|
|
/// response, and data.
|
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
/// - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the
|
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
/// enclosing async context is cancelled. Only applies to `DownloadTask`'s async
|
|
|
- /// properties. `false` by default.
|
|
|
|
|
|
|
+ /// properties. `true` by default.
|
|
|
///
|
|
///
|
|
|
/// - Returns: The `DownloadTask`.
|
|
/// - Returns: The `DownloadTask`.
|
|
|
public func serializingDownload<Serializer: DownloadResponseSerializerProtocol>(using serializer: Serializer,
|
|
public func serializingDownload<Serializer: DownloadResponseSerializerProtocol>(using serializer: Serializer,
|
|
|
- automaticallyCancelling shouldAutomaticallyCancel: Bool = false)
|
|
|
|
|
|
|
+ automaticallyCancelling shouldAutomaticallyCancel: Bool = true)
|
|
|
-> DownloadTask<Serializer.SerializedObject> {
|
|
-> DownloadTask<Serializer.SerializedObject> {
|
|
|
- downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) {
|
|
|
|
|
- self.response(queue: .singleEventQueue,
|
|
|
|
|
- responseSerializer: serializer,
|
|
|
|
|
- completionHandler: $0)
|
|
|
|
|
|
|
+ downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) { [self] in
|
|
|
|
|
+ response(queue: underlyingQueue,
|
|
|
|
|
+ responseSerializer: serializer,
|
|
|
|
|
+ completionHandler: $0)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|