alef 0.109.6

Opinionated polyglot binding generator for Rust libraries
Documentation
{#- Once-per-suite mock-request-count helper (alef issue #443).

   Context variables (see src/e2e/codegen/mock_assertions/helper.rs for the full contract):
   - helper_name: method name
   - total_path: mock server's total-count endpoint path
   - one_path: mock server's single-key endpoint path

   Emits ONE private member function using fully-qualified `java.net.http`/`java.net.URI` types,
   matching this backend's existing `http.rs` idiom (see `KotlinTestClientRenderer::render_call`,
   which already spells out `java.net.http.HttpClient`/`java.net.URI` in generated bodies with no
   corresponding import) -- so this helper adds no new import to gate on either. Callers build
   `pathAndQuery` from "{{ total_path }}?prefix=<p>" (mock.requests.total) or
   "{{ one_path }}?key=<k>" (mock.requests["<k>"]) -- see mock_assertions::model::MockQuery.
   Shared verbatim between `kotlin` and `kotlin_android`: both suites run on the host JVM (never
   a real Android device -- see `kotlin_android.rs`'s module doc), so `java.net.http` is available
   identically on both.
#}

    private fun {{ helper_name }}(baseUrl: String, pathAndQuery: String): Int {
        try {
            val request = java.net.http.HttpRequest.newBuilder(java.net.URI.create(baseUrl + pathAndQuery))
                .GET()
                .build()
            val response = java.net.http.HttpClient.newHttpClient()
                .send(request, java.net.http.HttpResponse.BodyHandlers.ofString())
            return response.body().trim().toInt()
        } catch (e: Exception) {
            throw RuntimeException("{{ helper_name }}: request failed: " + e.message, e)
        }
    }