Greatly simplify creation of Request and Context
Currently to create a Context its .. really hairy.
https://github.com/mehcode/shio-rs/blob/724880d5e5e644d63df096445b912a2fa36bcaf1/lib/src/router/mod.rs#L212-L215
We should be able to do something like:
let context: Context = ContextBuilder::new(handle)
// Set method on request in context (default: Get)
.method(Method::Get)
// Set URI on request (default: /)
.uri("/")
// With shared storage (default: Empty)
.shared(other_context.shared().clone())
// Returns a Result<Context> if URI parsing failed or something
.finalize()?;
I've started working on it. Currently I make it into util mod, but maybe into context (or testing, because mostly here for testing) is better ?
It'd make the most sense in a context/builder.rs file I'd think. Going by the Rust API guidelines it should probably be named shio::context::Builder.
We should also have a Context::builder(handle) or Context::build(handle) (unsure what name there, the http crate uses builder) method that is equivalent to shio::context::Builder::new(handle).
Ok, I will do that.