diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a72ecd27..e2c1541a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Fixed responses from silently failing to parse when missing a `description`, which is now an optional property that defaults to an empty string #193 - Add missing custom model protocol name #191 - Fixed missing customization of JSONEncoder instance to encode request's body #147 +- Fixed string uploads #161 ## 4.2.0 diff --git a/Specs/Petstore/generated/Swift/Sources/APIClient.swift b/Specs/Petstore/generated/Swift/Sources/APIClient.swift index 76bb0c0ec..20e2c5d79 100644 --- a/Specs/Petstore/generated/Swift/Sources/APIClient.swift +++ b/Specs/Petstore/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } }, diff --git a/Specs/PetstoreTest/generated/Swift/Sources/APIClient.swift b/Specs/PetstoreTest/generated/Swift/Sources/APIClient.swift index a69a24753..dc6d39c55 100644 --- a/Specs/PetstoreTest/generated/Swift/Sources/APIClient.swift +++ b/Specs/PetstoreTest/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } }, diff --git a/Specs/Rocket/generated/Swift/Sources/APIClient.swift b/Specs/Rocket/generated/Swift/Sources/APIClient.swift index 163bc020d..c895c5b7d 100644 --- a/Specs/Rocket/generated/Swift/Sources/APIClient.swift +++ b/Specs/Rocket/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } }, diff --git a/Specs/TBX/generated/Swift/Sources/APIClient.swift b/Specs/TBX/generated/Swift/Sources/APIClient.swift index ce2b0e02f..9ba576fce 100644 --- a/Specs/TBX/generated/Swift/Sources/APIClient.swift +++ b/Specs/TBX/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } }, diff --git a/Specs/TFL/generated/Swift/Sources/APIClient.swift b/Specs/TFL/generated/Swift/Sources/APIClient.swift index 9e235185e..d2bc3a1fd 100644 --- a/Specs/TFL/generated/Swift/Sources/APIClient.swift +++ b/Specs/TFL/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } }, diff --git a/Specs/TestSpec/generated/Swift/Sources/APIClient.swift b/Specs/TestSpec/generated/Swift/Sources/APIClient.swift index 9923003fc..330810816 100644 --- a/Specs/TestSpec/generated/Swift/Sources/APIClient.swift +++ b/Specs/TestSpec/generated/Swift/Sources/APIClient.swift @@ -114,6 +114,8 @@ public class APIClient { multipartFormData.append(url, withName: name) } else if let data = value as? Data { multipartFormData.append(data, withName: name) + } else if let string = value as? String { + multipartFormData.append(Data(string.utf8), withName: name) } } },