Skip to content

Commit c5836ff

Browse files
committed
refactor: remove redundant always-false condition
content is ByteArray is checked earlier
1 parent 5723ed6 commit c5836ff

File tree

22 files changed

+0
-44
lines changed
  • modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure
  • samples/client
    • others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure
    • petstore
      • kotlin-allOff-discriminator/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-kotlinx-datetime/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-name-parameter-mappings/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure
      • kotlin/src/main/kotlin/org/openapitools/client/infrastructure

22 files changed

+0
-44
lines changed

modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ import com.squareup.moshi.adapter
210210
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
211211
}
212212
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
213-
mediaType == OctetMediaType && content is ByteArray ->
214-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
215213
mediaType == TextMediaType && content is String ->
216214
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
217215
// TODO: this should be extended with other serializers

samples/client/others/kotlin-jvm-okhttp-parameter-tests/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-allOff-discriminator/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-bigdecimal-default-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-default-values-jvm-okhttp4/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-explicit/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ public open class ApiClient(public val baseUrl: String, public val client: Call.
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
170170
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
171171
}
172172
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
173-
mediaType == OctetMediaType && content is ByteArray ->
174-
content.toRequestBody(OctetMediaType.toMediaTypeOrNull())
175173
mediaType == TextMediaType && content is String ->
176174
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
177175
// TODO: this should be extended with other serializers

0 commit comments

Comments
 (0)