pub fn render_mock_server_binary() -> StringExpand description
Generate the src/main.rs for the standalone mock server binary.
The binary:
- Reads all
*.jsonfixture files from a fixtures directory (default../../fixtures). - For each fixture that has a
mock_responsefield, registers a route at/fixtures/{fixture_id}returning the configured status/body/SSE chunks. - Binds to
127.0.0.1:0(random port), printsMOCK_SERVER_URL=http://...to stdout, then waits until stdin is closed for clean teardown. - Fixtures that declare host-root paths (
/robots.txt,/sitemap.*, etc.) get their own dedicated listener so the crawler can fetch them from the host root. A second lineMOCK_SERVERS={...}(sorted JSON object) maps fixture_id → base URL for those.
This binary is intended for cross-language e2e suites (WASM, Node) that spawn it as a child process and read the URL from its stdout.