Skip to content

Add Ktor HTTP data source module#3071

Open
k88936 wants to merge 29 commits intoandroidx:mainfrom
k88936:feat/ktor-datasource
Open

Add Ktor HTTP data source module#3071
k88936 wants to merge 29 commits intoandroidx:mainfrom
k88936:feat/ktor-datasource

Conversation

@k88936
Copy link
Copy Markdown

@k88936 k88936 commented Feb 14, 2026

Summary

Introduce a new lib-datasource-ktor module similar to libraries/datasource_okhttp, providing KtorDataSource as an alternative HTTP data source implementation using Ktor client to solve issue #1646 .

What changed

  • impl: androidx.media3.datasource.DataSource using ktor
  • test: a unit test for DataSourceContractTest. and a unit test for it own.
  • api.txt in the repo root
  • some gradle config for include this module

Why

I recent met the same problem for maintaining both a okhttp client and a ktor client, similar to #1646 (comment)

Copy link
Copy Markdown
Collaborator

@icbaker icbaker left a comment

Choose a reason for hiding this comment

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

I've pushed a few commits, and added a few comments too

@k88936 k88936 force-pushed the feat/ktor-datasource branch 3 times, most recently from c0f7038 to 919b31d Compare February 25, 2026 04:10
@k88936 k88936 requested a review from icbaker February 25, 2026 04:31
@icbaker icbaker force-pushed the feat/ktor-datasource branch from c6ae2f3 to ca7ae8c Compare March 10, 2026 13:57
@icbaker icbaker force-pushed the feat/ktor-datasource branch from dcc4c38 to 3a43094 Compare March 19, 2026 12:22
@k88936 k88936 requested a review from icbaker March 23, 2026 12:41
@k88936 k88936 force-pushed the feat/ktor-datasource branch from 8231c9d to cacf0ad Compare March 31, 2026 09:36
@icbaker icbaker force-pushed the feat/ktor-datasource branch 3 times, most recently from a3ac1be to e70d3f9 Compare April 1, 2026 15:21
k88936 and others added 11 commits April 8, 2026 09:35
Introduce a new lib-datasource-ktor module similar to `libraries/datasource_okhttp`.
 Providing KtorDataSource as an alternative HTTP data source implementation using Ktor client.

# Conflicts:
#	constants.gradle
#	core_settings.gradle
In the past we have found Robolectric is not realistic enough for
testing fiddly edge cases in HTTP stacks, so running on an emulator with
real Android OS is better.
We can promote it to stable later
io.ktor.http.Headers it self is a case-insensitive map already
This reverts commit b51daad.

fix: failed test case , we not only need a case-insensitively stored map,
 we also need a case-insensitively look up map.
@icbaker icbaker force-pushed the feat/ktor-datasource branch from 0f26e79 to a70c5c2 Compare April 8, 2026 08:56
@icbaker
Copy link
Copy Markdown
Collaborator

icbaker commented Apr 8, 2026

I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants