worldline / worldline/devview

refactor: make MockHttpClientCall internal

Open Beginner friendly
#89 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue stale
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 to internal.
  • 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 MockHttpClientCall directly (check devview-networkmock-ktor/src/androidHostTest/... and sample/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

  • MockHttpClientCall is internal, not public.
  • devview-networkmock-ktor/api/api.txt is regenerated and no longer lists MockHttpClientCall.
  • All existing tests still pass without needing to construct MockHttpClientCall directly.

Files likely touched

  • devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt
  • devview-networkmock-ktor/api/api.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.