1use std::collections::HashMap;
2
3pub struct Request {
5 inner: hyper::Request<hyper::body::Incoming>,
6 params: HashMap<String, String>,
7}
8
9impl Request {
10 pub fn new(inner: hyper::Request<hyper::body::Incoming>) -> Self {
11 Self {
12 inner,
13 params: HashMap::new(),
14 }
15 }
16
17 pub fn with_params(mut self, params: HashMap<String, String>) -> Self {
18 self.params = params;
19 self
20 }
21
22 pub fn method(&self) -> &hyper::Method {
24 self.inner.method()
25 }
26
27 pub fn path(&self) -> &str {
29 self.inner.uri().path()
30 }
31
32 pub fn param(&self, name: &str) -> Option<&String> {
34 self.params.get(name)
35 }
36
37 pub fn params(&self) -> &HashMap<String, String> {
39 &self.params
40 }
41
42 pub fn inner(&self) -> &hyper::Request<hyper::body::Incoming> {
44 &self.inner
45 }
46}