Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response returns NullBody instead of null for StatusCode 204 and 205 #517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project orients towards [Semantic Versioning](http://semver.org/spec/v2
Note: This project needs KSP to work and every new Ktorfit with an update of the KSP version is technically a breaking change.
But there is no intent to bump the Ktorfit major version for every KSP update.

### Changed
- Response returns NullBody instead of null for StatusCode 204 and 205

1.12.0 - 2024-01-16
========================================
- Compatible with KSP 1.0.16 and Kotlin 1.9.22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import de.jensklingenberg.ktorfit.converter.KtorfitResult
import de.jensklingenberg.ktorfit.internal.TypeData
import io.ktor.client.call.*
import io.ktor.client.statement.*
import io.ktor.http.content.NullBody

internal class DefaultResponseClassSuspendConverter(private val typeData: TypeData, private val ktorfit: Ktorfit) :
Converter.SuspendResponseConverter<HttpResponse, Response<Any?>> {
Expand All @@ -27,7 +28,7 @@ internal class DefaultResponseClassSuspendConverter(private val typeData: TypeDa
}

code == 204 || code == 205 -> {
Response.success(null, rawResponse)
Response.success(NullBody, rawResponse)
}

else -> {
Expand Down