Skip to content

Conversation

@zibet27
Copy link
Collaborator

@zibet27 zibet27 commented Dec 3, 2025

Subsystem
Server

Motivation
I was confused that calling call.respondText() doesn't set the status code to 200 if it was assigned before.

Solution
Mentioned this behaviour in KDocs.

@zibet27 zibet27 requested review from bjhham, e5l and vnikolova December 3, 2025 16:38
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

Updated KDoc comments and a copyright year in ApplicationResponseFunctions; removed an unused import. No public API or behavior changes.

Changes

Cohort / File(s) Summary
KDoc & metadata updates
ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt
Updated copyright year (2024 → 2025); removed io.ktor.utils.io.core.* import; revised KDoc for respondText, respondBytes, respondSource, and respondBytesWriter — clarified contentType and status parameter docs (status: "defaults to HttpStatusCode.OK unless already assigned") and added @param entries for contentLength and producer in respondBytesWriter. No signature or behavior changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Changes are documentation and a non-functional import cleanup.
  • No logic or API surface to verify.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating KDocs for Application.respond methods, which aligns with the changeset.
Description check ✅ Passed The description follows the required template with all sections completed: Subsystem, Motivation, and Solution are all present and provide clear context.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zibet27/update-kdocs-for-appplication-respond

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d58b43 and 1cec757.

📒 Files selected for processing (1)
  • ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt (7 hunks)
✅ Files skipped from review due to trivial changes (1)
  • ktor-server/ktor-server-core/common/src/io/ktor/server/response/ApplicationResponseFunctions.kt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zibet27 zibet27 changed the title Server. Update KDocs for that may set status. Server. Update KDocs for Application.respond... Dec 3, 2025
@zibet27 zibet27 self-assigned this Dec 4, 2025
@zibet27 zibet27 enabled auto-merge (squash) December 5, 2025 09:43
@zibet27 zibet27 added 👍 ship! This pull request can be shipped bypassing review. Read about "Ship/Show/Ask" strategy for more info and removed 👍 ship! This pull request can be shipped bypassing review. Read about "Ship/Show/Ask" strategy for more info labels Dec 5, 2025
* @see [io.ktor.server.response.ApplicationResponse]
* @param contentType is an optional [ContentType], default is [ContentType.Text.Plain]
* @param status is an optional [HttpStatusCode], default is [HttpStatusCode.OK]
* @param status is an optional [HttpStatusCode], default is [HttpStatusCode.OK] unless already assigned
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with other KDocs, I suggest to omit the verb (is) in this and the next occurrences:

Suggested change
* @param status is an optional [HttpStatusCode], default is [HttpStatusCode.OK] unless already assigned
* @param status An optional [HttpStatusCode], defaults to [HttpStatusCode.OK] unless already assigned

*
* [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.server.response.respondBytesWriter)
*
* @param contentType An optional [ContentType], unspecified by default
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the default contentType actually ContentType.Application.OctetStream?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vnikolova afaik it is used as a default in the Client's defaultTransformers. But on the server, it's chosen depending on the data sent, isn't it? @bjhham

@zibet27 zibet27 force-pushed the zibet27/update-kdocs-for-appplication-respond branch from 0d58b43 to 1cec757 Compare December 8, 2025 10:12
@zibet27 zibet27 requested a review from vnikolova December 8, 2025 10:12
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.

5 participants