pub fn cookie_name() -> StringExpand description
This app’s own session cookie name, derived from Config::app_name -
public so larust_testing::TestClient::acting_as can adopt a session by
hand-crafting the exact same Cookie header the router’s own session
layer (above) would issue, without needing a real /login round trip.
Must stay the single source of truth for the name: any second place
that re-derives it independently risks drifting out of sync with
whatever session_layer actually configured.
Uses larust_core::try_config(), not config() - a handful of narrow
router-building test helpers (see e.g.
examples/blog/tests/store_post_test.rs) build a session-bearing
router directly off a bare pool, with no Application::new() call
anywhere in the test at all, since nothing else they exercise needs
one. Falling back to a fixed name in that case (rather than panicking)
keeps this a purely additive change - every real app (main.rs always
calls Application::new() first) still gets a properly app-scoped
cookie name; a test with no Application just gets a stable shared one
instead, which is harmless since nothing about in-process oneshot()-
driven tests risks the actual cross-app cookie collision this scoping
exists to prevent in a real browser.