Skip to main content

fetchlet_http/axum_server/
transport.rs

1use axum::Router;
2
3use fetchlet::FetchTransport;
4
5use crate::service_transport;
6
7/// Serve host fetches with an axum `Router`.
8///
9/// This is [`service_transport`] for a router: register it
10/// with [`fetchlet::OriginRouter::internal`] to share one router between
11/// public HTTP and in-process fetches. Handlers read the trusted Context with
12/// `Option<Extension<fetchlet::Context>>`.
13pub fn router_transport(router: Router) -> impl FetchTransport {
14    service_transport(router)
15}