Expand description
HTTP(S) server runtime.
§5.0 layout
The Server struct holds the listener addresses and the shared
application state. AppState in turn holds a Config (editable
declarative data from apimock-config) alongside LoadedMiddlewares
(compiled Rhai — runtime only, server-owned).
Dispatch methods (middleware_response, rule_set_response) used
to hang off ServiceConfig but were moved here in 5.0 because they
build hyper::Response values, which a config crate must not do.
They are now free functions in this module that take borrowed config
- loaded state and produce an
hyper::Response.
Re-exports§
pub use crate::control::ReloadHint;pub use crate::control::ServerControl;pub use crate::control::ServerHandle;pub use crate::control::ServerState;
Structs§
- AppState
- Shared state, held once and read by reference from each per-request
task via
Arc<AppState>— seeServer::app_state. - Server
- HTTP(S) server.
Functions§
- handle_
options - OPTIONS request handler (CORS preflight).
pubsoapimock get(RFC 055) can answer for anOPTIONSrequest through the exact same functionservicecalls, rather than reimplementing it. - service
- Entry point for each HTTP request.