Skip to content

Commit

Permalink
Add default encoding option for simpler code
Browse files Browse the repository at this point in the history
See the following comment for rationale:
Moya#1135 (comment)
  • Loading branch information
Jeehut authored and sunshinejr committed Aug 11, 2017
1 parent 5e5925f commit 8871b58
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Moya/TargetType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public protocol TargetType {
/// The HTTP method used in the request.
var method: Moya.Method { get }

/// The default parameterEncoding for the `.encoded` RequestDataType case.
var defaultParameterEncoding: ParameterEncoding { get }

/// Provides stub data for use in testing.
var sampleData: Data { get }

Expand All @@ -26,6 +29,10 @@ public protocol TargetType {
}

public extension TargetType {
var defaultParameterEncoding: ParameterEncoding {
return URLEncoding.default
}

var validate: Bool {
return false
}
Expand Down

0 comments on commit 8871b58

Please sign in to comment.