mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 17:07:01 +02:00
re-export ServiceFactory (#2325)
This commit is contained in:
@@ -24,20 +24,14 @@ use {
|
||||
|
||||
use crate::{error::Error, HttpResponseBuilder};
|
||||
|
||||
/// An HTTP Response
|
||||
/// An outgoing response.
|
||||
pub struct HttpResponse<B = AnyBody> {
|
||||
res: Response<B>,
|
||||
pub(crate) error: Option<Error>,
|
||||
}
|
||||
|
||||
impl HttpResponse<AnyBody> {
|
||||
/// Create HTTP response builder with specific status.
|
||||
#[inline]
|
||||
pub fn build(status: StatusCode) -> HttpResponseBuilder {
|
||||
HttpResponseBuilder::new(status)
|
||||
}
|
||||
|
||||
/// Create a response.
|
||||
/// Constructs a response.
|
||||
#[inline]
|
||||
pub fn new(status: StatusCode) -> Self {
|
||||
Self {
|
||||
@@ -46,6 +40,12 @@ impl HttpResponse<AnyBody> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs a response builder with specific HTTP status.
|
||||
#[inline]
|
||||
pub fn build(status: StatusCode) -> HttpResponseBuilder {
|
||||
HttpResponseBuilder::new(status)
|
||||
}
|
||||
|
||||
/// Create an error response.
|
||||
#[inline]
|
||||
pub fn from_error(error: impl Into<Error>) -> Self {
|
||||
|
Reference in New Issue
Block a user