Permalink
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (32 sloc) 1.16 KB
import Foundation
/// The protocol used to define the specifications necessary for a `MoyaProvider`.
public protocol TargetType {
/// The target's base `URL`.
var baseURL: URL { get }
/// The path to be appended to `baseURL` to form the full `URL`.
var path: String { get }
/// The HTTP method used in the request.
var method: Moya.Method { get }
/// Provides stub data for use in testing.
var sampleData: Data { get }
/// The type of HTTP task to be performed.
var task: Task { get }
/// The type of validation to perform on the request. Default is `.none`.
var validationType: ValidationType { get }
/// The headers to be used in the request.
var headers: [String: String]? { get }
}
public extension TargetType {
/// The type of validation to perform on the request. Default is `.none`.
var validationType: ValidationType {
return .none
}
}
// MARK: - Deprecated
extension TargetType {
@available(*, deprecated: 11.0, message:
"TargetType's validate property has been deprecated in 11.0. Please use validationType: ValidationType.")
var validate: Bool {
return false
}
}