pub struct Response {
pub status: u16,
pub status_message: String,
pub headers: HashMap<String, String>,
pub body: ResponseBody,
}Expand description
HTTP response.
Fields§
§status: u16HTTP status code
status_message: StringStatus message
headers: HashMap<String, String>Response headers
body: ResponseBodyResponse body
Implementations§
Source§impl Response
impl Response
Sourcepub fn no_content() -> Self
pub fn no_content() -> Self
Create a 204 No Content response.
Sourcepub fn bad_request(message: &str) -> Self
pub fn bad_request(message: &str) -> Self
Create a 400 Bad Request response.
Create a 401 Unauthorized response.
Sourcepub fn internal_error(message: &str) -> Self
pub fn internal_error(message: &str) -> Self
Create a 500 Internal Server Error response.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoMetered for T
impl<T> IntoMetered for T
Source§fn metered(self, metrics: Arc<ChannelMetrics>) -> MeteredSender<Self>
fn metered(self, metrics: Arc<ChannelMetrics>) -> MeteredSender<Self>
Wrap this sender with metrics tracking.
Source§impl<T> WithMetrics for T
impl<T> WithMetrics for T
Source§fn with_metrics(self) -> MeteredWrapper<Self>
fn with_metrics(self) -> MeteredWrapper<Self>
Wrap this channel with metrics tracking.