[swift5] Fix missing case for FormDataEncoding#encode (#11064)

Fixes #11062
This commit is contained in:
Deniz Dogan 2021-12-10 07:08:32 +01:00 committed by GitHub
parent 550c0781dc
commit c94d2b2331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 139 additions and 0 deletions

View File

@ -114,6 +114,8 @@ private var managerStore = SynchronizedDictionary<String, Alamofire.Session>()
mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k)
case let number as NSNumber: case let number as NSNumber:
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
case let data as Data:
mpForm.append(data, withName: k)
default: default:
fatalError("Unprocessable value \(v) with key \(k)") fatalError("Unprocessable value \(v) with key \(k)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -114,6 +114,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k)
case let number as NSNumber: case let number as NSNumber:
mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k)
case let data as Data:
mpForm.append(data, withName: k)
default: default:
fatalError("Unprocessable value \(v) with key \(k)") fatalError("Unprocessable value \(v) with key \(k)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }

View File

@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding {
) )
} }
case let data as Data:
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default: default:
fatalError("Unprocessable value \(value) with key \(key)") fatalError("Unprocessable value \(value) with key \(key)")
} }