Skip to content

Commit 840720a

Browse files
committed
Fix image upload for content-type image
1 parent 65cb95b commit 840720a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
140140
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
141141
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
142142
encoding = FormURLEncoding()
143-
} else if contentType.hasPrefix("application/octet-stream"){
143+
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
144144
encoding = OctetStreamEncoding()
145145
} else {
146146
fatalError("Unsupported Media Type - \(contentType)")

modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable {
140140
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
141141
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
142142
encoding = FormURLEncoding()
143-
} else if contentType.hasPrefix("application/octet-stream"){
143+
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
144144
encoding = OctetStreamEncoding()
145145
} else {
146146
fatalError("Unsupported Media Type - \(contentType)")

0 commit comments

Comments
 (0)