Skip to content

Commit

Permalink
Rename ParameterEncoding's cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Apr 7, 2016
1 parent dedcbd8 commit 5689e08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Sources/Backends/AlamofireBackend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class AlamofireBackend: BackendType {
request.allHTTPHeaderFields = endpoint.headerFields

switch endpoint.parameterEncoding {
case .Form, .JSON:
case .URL, .JSON:
let encodedRequest = self.encodeParameters(request, parameterEncoding: endpoint.parameterEncoding, parameters: endpoint.parameters).0
let alamofireRequest = self.manager.request(encodedRequest)
cancellableToken.request = alamofireRequest
Expand All @@ -79,12 +79,12 @@ public class AlamofireBackend: BackendType {
if !self.manager.startRequestsImmediately {
alamofireRequest.resume()
}
case .FormWithMultipartData:
case .MultipartFormData:
var components: [(String, String)] = []
var multipartComponents: [String: MultipartData] = [:]
var multipartComponents: [String:MultipartFormData] = [:]

for (key, value) in endpoint.parameters {
if let multipartData = value as? MultipartData {
if let multipartData = value as? MultipartFormData {
multipartComponents[key] = multipartData
} else {
components += Alamofire.ParameterEncoding.URL.queryComponents(key, value)
Expand Down Expand Up @@ -164,7 +164,7 @@ public class AlamofireBackend: BackendType {

private func encodeParameters(request: NSMutableURLRequest, parameterEncoding: ParameterEncoding, parameters: [String: AnyObject]) -> (NSMutableURLRequest, NSError?) {
switch parameterEncoding {
case .Form:
case .URL:
return Alamofire.ParameterEncoding.URL.encode(request, parameters: parameters)
case .JSON:
return Alamofire.ParameterEncoding.JSON.encode(request, parameters: parameters)
Expand Down
8 changes: 4 additions & 4 deletions Sources/MoyaX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ public enum HTTPMethod: String {
}

public enum ParameterEncoding {
case Form
case FormWithMultipartData
case URL
case MultipartFormData
case JSON
}

// http://www.iana.org/assignments/media-types/media-types.xhtml
public enum MultipartData {
public enum MultipartFormData {
case Data(NSData, fileName: String, mimeType: String)
case File(NSURL, fileName: String, mimeType: String)
case Stream(NSInputStream, length: UInt64, fileName: String, mimeType: String)
Expand Down Expand Up @@ -48,7 +48,7 @@ public extension TargetType {
return [:]
}
var parameterEncoding: ParameterEncoding {
return .Form
return .URL
}

var fullURL: NSURL {
Expand Down

0 comments on commit 5689e08

Please sign in to comment.