Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createURLSession() -> URLSession {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

internal protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
internal func createURLSession() -> URLSession {
internal func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
internal func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
internal func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Foundation
import MobileCoreServices
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
}

extension URLSession: URLSessionProtocol {}

class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
return URLSessionRequestBuilder<T>.self
Expand Down Expand Up @@ -57,7 +63,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLSession
configuration.
*/
open func createURLSession() -> URLSession {
open func createURLSession() -> URLSessionProtocol {
return defaultURLSession
}

Expand All @@ -76,7 +82,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the URLRequest
configuration (e.g. to override the cache policy).
*/
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {

guard let url = URL(string: URLString) else {
throw DownloadException.requestMissingURL
Expand Down
Loading