refactor: make MockHttpClientCall internal
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 10
- Forks
- 2
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 13
Description
Summary
MockHttpClientCall is a public class purely because Ktor's HttpClientCall(client) base constructor requires it to be instantiable from the plugin's install code — it should be internal. This is independent of the OpenAPI migration (tracked in the epic, #72) and can be picked up any time. Good first issue: small, self-contained, mechanical.
Current state
MockHttpClientCall (devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt:356-408) is declared public class MockHttpClientCall(client: HttpClient) : HttpClientCall(client). It's part of the tracked public API surface (devview-networkmock-ktor/api/api.txt), but nothing about it is meant to be integrator-facing — it's an internal implementation detail of how the plugin fabricates a synthetic response. Its rawContent override is annotated @InternalAPI (:390-393), meaning it already depends on a Ktor API that isn't stable — being public compounds that risk, since any breaking change to Ktor's internals here would be a breaking change to this library's public API too, for a type integrators have no legitimate reason to construct themselves.
What to build
- Change
MockHttpClientCall's visibility tointernal. - Verify this compiles —
createMockHttpClientCall(:322-346), the only caller, is a private top-level function in the same file, so this should be a clean visibility narrowing with no call-site changes needed elsewhere. - Confirm no test or sample code constructs
MockHttpClientCalldirectly (checkdevview-networkmock-ktor/src/androidHostTest/...andsample/network/...) — if something does, that usage needs to move to a public entry point (or the test needs restructuring to not require direct construction).
Acceptance criteria
-
MockHttpClientCallisinternal, notpublic. -
devview-networkmock-ktor/api/api.txtis regenerated and no longer listsMockHttpClientCall. - All existing tests still pass without needing to construct
MockHttpClientCalldirectly.
Files likely touched
devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.ktdevview-networkmock-ktor/api/api.txt
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt, checking MockHttpClientCall and its createMockHttpClientCall caller. Check androidHostTest and sample/network for direct construction, then regenerate devview-networkmock-ktor/api/api.txt. Done means the class is internal, no direct external construction remains, and existing tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100