{#- 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: function name
- total_path: mock server's total-count endpoint path
- one_path: mock server's single-key endpoint path
Emits ONE function taking the mock server's base URL and a fully-formed path-and-query string,
returning the endpoint's plain-text decimal integer body as an R integer. Uses only base R's
`url()` connection + `readLines()` -- no `httr`/`curl` dependency, matching this backend's
existing "no HTTP client package" discipline (the scaffolded DESCRIPTION declares no such
package; see r/project.rs's `render_description`). Callers build `pathAndQuery` from
"{{ total_path }}?prefix=<p>" (mock.requests.total) or "{{ one_path }}?key=<k>"
(mock.requests["<k>"]) -- see mock_assertions::model::MockQuery.
#}
{{ helper_name }} <- function(base_url, path_and_query) {
con <- url(paste0(base_url, path_and_query))
on.exit(close(con), add = TRUE)
body <- paste(readLines(con, warn = FALSE), collapse = "")
as.integer(trimws(body))
}