mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 07:53:39 +00:00
[swift] [urlsession] Fixes crash for uploads with content-type "image/" (#21544)
* Fix image upload for content-type image * update samples * add test case in spec and update samples * update bitrise stack so we get xcpretty 0.4.1 * Revert "add test case in spec and update samples" This reverts commit 92202dd8506b2482cda69fe1d95a61d5a51881e3.
This commit is contained in:
parent
ca8c6d2f5d
commit
f9098d5a89
@ -48,4 +48,4 @@ workflows:
|
||||
|
||||
meta:
|
||||
bitrise.io:
|
||||
stack: osx-xcode-16.0.x
|
||||
stack: osx-xcode-16.3.x
|
||||
|
@ -140,7 +140,7 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendab
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
@ -140,7 +140,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||
encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
} else if contentType.hasPrefix("application/x-www-form-urlencoded") {
|
||||
encoding = FormURLEncoding()
|
||||
} else if contentType.hasPrefix("application/octet-stream"){
|
||||
} else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") {
|
||||
encoding = OctetStreamEncoding()
|
||||
} else {
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
|
Loading…
x
Reference in New Issue
Block a user