Struct actix_web::HttpResponse
[−]
[src]
pub struct HttpResponse {
pub version: Option<Version>,
pub headers: HeaderMap,
pub status: StatusCode,
// some fields omitted
}An HTTP Response
Fields
version: Option<Version>
headers: HeaderMap
status: StatusCode
Methods
impl HttpResponse[src]
fn builder(status: StatusCode) -> HttpResponseBuilder[src]
fn new(status: StatusCode, body: Body) -> HttpResponse[src]
Constructs a response
fn from_error<E: Error + 'static>(status: StatusCode, error: E) -> HttpResponse[src]
Constructs a response from error
fn error(&self) -> Option<&Box<Error>>[src]
The error which is responsible for this response
fn version(&self) -> Option<Version>[src]
Get the HTTP version of this response.
fn headers(&self) -> &HeaderMap[src]
Get the headers from the response.
fn headers_mut(&mut self) -> &mut HeaderMap[src]
Get a mutable reference to the headers.
fn status(&self) -> StatusCode[src]
Get the status from the server.
fn status_mut(&mut self) -> &mut StatusCode[src]
Set the StatusCode for this response.
fn reason(&self) -> &str[src]
Get custom reason for the response.
fn set_reason(&mut self, reason: &'static str) -> &mut Self[src]
Set the custom reason for the response.
fn set_connection_type(&mut self, conn: ConnectionType) -> &mut Self[src]
Set connection type
fn upgrade(&self) -> bool[src]
Connection upgrade status
fn keep_alive(&self) -> Option<bool>[src]
Keep-alive status for this connection
fn chunked(&self) -> bool[src]
is chunked encoding enabled
fn enable_chunked_encoding(&mut self) -> Result<(), Error>[src]
Enables automatic chunked transfer encoding
fn body(&self) -> &Body[src]
Get body os this response
fn set_body<B: Into<Body>>(&mut self, body: B)[src]
Set a body
fn replace_body<B: Into<Body>>(&mut self, body: B) -> Body[src]
Set a body and return previous body value
Trait Implementations
impl From<ParseError> for HttpResponse[src]
Return BadRequest for ParseError
fn from(err: ParseError) -> Self[src]
Performs the conversion.
impl From<HttpError> for HttpResponse[src]
Return InternalServerError for HttpError,
Response generation can return HttpError, so it is internal error
impl From<IoError> for HttpResponse[src]
Return InternalServerError for io::Error
impl From<ParseError> for HttpResponse[src]
Return BadRequest for cookie::ParseError
fn from(err: ParseError) -> Self[src]
Performs the conversion.
impl From<MultipartError> for HttpResponse[src]
Return BadRequest for MultipartError
fn from(err: MultipartError) -> Self[src]
Performs the conversion.
impl From<HttpRangeParseError> for HttpResponse[src]
Return BadRequest for HttpRangeParseError
fn from(_: HttpRangeParseError) -> Self[src]
Performs the conversion.
impl Debug for HttpResponse[src]
impl<I: Into<HttpResponse>, E: Into<HttpResponse>> From<Result<I, E>> for HttpResponse[src]
Helper conversion implementation
impl From<StaticResponse> for HttpResponse[src]
fn from(st: StaticResponse) -> Self[src]
Performs the conversion.