Skip to content

Commit

Permalink
[swift]: support uuid in FormDataEncoding (#13228)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinjul committed Aug 29, 2022
1 parent 27f3a5c commit 2c0d886
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
case let data as Data:
mpForm.append(data, withName: k)
case let uuid as UUID:
mpForm.append(uuid.uuidString.data(using: String.Encoding.utf8)!, withName: k)
default:
fatalError("Unprocessable value \(v) with key \(k)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
case let data as Data:
mpForm.append(data, withName: k)
case let uuid as UUID:
mpForm.append(uuid.uuidString.data(using: String.Encoding.utf8)!, withName: k)
default:
fatalError("Unprocessable value \(v) with key \(k)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ private class FormDataEncoding: ParameterEncoding {
data: data
)

case let uuid as UUID:

if let data = uuid.uuidString.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}

default:
fatalError("Unprocessable value \(value) with key \(key)")
}
Expand Down

0 comments on commit 2c0d886

Please sign in to comment.