Skip to content

[Ktor] Refactor HTTP utilities to use top-level extensions#187

Merged
rfc2822 merged 2 commits into
mainfrom
url-parent
Jun 22, 2026
Merged

[Ktor] Refactor HTTP utilities to use top-level extensions#187
rfc2822 merged 2 commits into
mainfrom
url-parent

Conversation

@rfc2822

@rfc2822 rfc2822 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Refactors KtorHttpUtils to HttpUtils with top-level extension functions, following the same pattern as UrlUtils. This includes:

  • Moving ContentType extensions (isText, isXml) and String.toContentTypeOrNull() to ContentTypeUtils.kt
  • Adding String.toUrlOrNull() to UrlUtils.kt
  • Updating all usages in DavResource.kt, Response.kt, ResponseParser.kt, and PropStatParser.kt
  • Adding corresponding tests in ContentTypeUtilsTest.kt and UrlUtilsTest.kt
  • Updating deprecation in OkHttpUtils.kt to point to HttpUtils

rfc2822 and others added 2 commits June 22, 2026 15:20
- Create ContentTypeUtils.kt with ContentType extensions (isText, isXml)
  and String.toContentTypeOrNull()
- Add String.toUrlOrNull() extension to UrlUtils.kt
- Rename KtorHttpUtils.kt to HttpUtils.kt and object to HttpUtils
- Update all usages of KtorHttpUtils to HttpUtils in DavResource.kt,
  Response.kt, ResponseParser.kt, PropStatParser.kt
- Create ContentTypeUtilsTest.kt with tests for ContentType extensions
- Rename KtorHttpUtilsTest.kt to HttpUtilsTest.kt
- Add tests for toUrlOrNull to UrlUtilsTest.kt
- Update deprecation in OkHttpUtils.kt to point to HttpUtils

This follows the same pattern as the UrlUtils.kt refactor, using top-level
extension methods where appropriate and grouping related utilities into
semantic files.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@rfc2822 rfc2822 self-assigned this Jun 22, 2026
@rfc2822 rfc2822 added the refactoring Internal improvement of existing functions label Jun 22, 2026
@rfc2822 rfc2822 marked this pull request as ready for review June 22, 2026 13:48
@rfc2822 rfc2822 merged commit a9706d5 into main Jun 22, 2026
3 checks passed
@rfc2822 rfc2822 deleted the url-parent branch June 22, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Internal improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant