pub struct Http { /* private fields */ }Expand description
http: reaching a server, and being one.
Implementations§
Source§impl Http
impl Http
Sourcepub fn real() -> Self
pub fn real() -> Self
A host that speaks HTTP/1.1 over TCP.
listen binds loopback only. Granting http is authority to talk to
the machine’s own network stack, not permission to publish a service
on every interface the machine has.
Sourcepub fn recorded(
answers: BTreeMap<String, RecordedResponse>,
requests: Vec<ScriptedRequest>,
) -> Self
pub fn recorded( answers: BTreeMap<String, RecordedResponse>, requests: Vec<ScriptedRequest>, ) -> Self
A fake that answers fetch from answers and lets a listener replay
requests, for tests.
The key is the URL exactly as the program writes it. This is a recorded answer, not a client: a fake that resolved a host name would be reaching the network the grant was supposed to describe.
Trait Implementations§
Source§impl HostApi for Http
impl HostApi for Http
Source§fn call_with(
&self,
op: &str,
args: Vec<Value>,
back: &mut dyn Reentry,
) -> Result<Value, RuntimeError>
fn call_with( &self, op: &str, args: Vec<Value>, back: &mut dyn Reentry, ) -> Result<Value, RuntimeError>
fetch is the one module-level operation that waits, so it is the one
that needs the way back: not to run a callback, but to ask how long
the run it belongs to still has and whether it has been told to stop.
Everything else here touches only what it was given.