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

KTOR-6125 ContentNegotiation with protobuf fails on empty body #3700

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

rsinukov
Copy link
Contributor

@rsinukov rsinukov requested a review from marychatte July 19, 2023 13:52
@rsinukov rsinukov self-assigned this Jul 19, 2023
@@ -72,7 +72,7 @@ public class KotlinxSerializationConverter(
val fromExtension = extensions.asFlow()
.map { it.deserialize(charset, typeInfo, content) }
.firstOrNull { it != null || content.isClosedForRead }
if (fromExtension != null || content.isClosedForRead) return fromExtension
if (extensions.isNotEmpty() && (fromExtension != null || content.isClosedForRead)) return fromExtension
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add this check in serializeNullable(..) { ... if (fromExtension != null) return fromExtension ... }?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because if fromExtension != null then extensions are always not empty

Copy link
Member

@marychatte marychatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rsinukov rsinukov merged commit eb14d53 into main Jul 20, 2023
2 checks passed
@rsinukov rsinukov deleted the rsinukov/brotobuf-empty branch July 20, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants