nyquest_interface/
request.rs1use std::{borrow::Cow, fmt::Debug};
7
8use crate::body::Body;
9
10#[derive(Debug, Clone, PartialEq, Eq, Hash)]
12pub enum Method {
13 Get,
15 Post,
17 Put,
19 Delete,
21 Patch,
23 Head,
25 Other(Cow<'static, str>),
27}
28
29pub struct Request<S> {
31 pub method: Method,
33 pub relative_uri: Cow<'static, str>,
35 pub additional_headers: Vec<(Cow<'static, str>, Cow<'static, str>)>,
37 pub body: Option<Body<S>>,
39}
40
41impl<S> Debug for Request<S>
42where
43 Body<S>: Debug,
44{
45 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
46 f.debug_struct("Request")
47 .field("method", &self.method)
48 .field("relative_uri", &self.relative_uri)
49 .field("additional_headers", &self.additional_headers)
50 .field("body", &self.body)
51 .finish()
52 }
53}
54
55impl<S> Clone for Request<S>
56where
57 Body<S>: Clone,
58{
59 fn clone(&self) -> Self {
60 Self {
61 method: self.method.clone(),
62 relative_uri: self.relative_uri.clone(),
63 additional_headers: self.additional_headers.clone(),
64 body: self.body.clone(),
65 }
66 }
67}