# [−][src]Struct actix_web::HttpResponse

    pub struct HttpResponse(_, _);

An HTTP Response

## Methods

###

`impl HttpResponse`

[src]

####

`pub fn Ok() -> HttpResponseBuilder`

[src]

####

`pub fn Created() -> HttpResponseBuilder`

[src]

####

`pub fn Accepted() -> HttpResponseBuilder`

[src]

####

`pub fn NonAuthoritativeInformation() -> HttpResponseBuilder`

[src]

####

`pub fn NoContent() -> HttpResponseBuilder`

[src]

####

`pub fn ResetContent() -> HttpResponseBuilder`

[src]

####

`pub fn PartialContent() -> HttpResponseBuilder`

[src]

####

`pub fn MultiStatus() -> HttpResponseBuilder`

[src]

####

`pub fn AlreadyReported() -> HttpResponseBuilder`

[src]

####

`pub fn MultipleChoices() -> HttpResponseBuilder`

[src]

####

`pub fn MovedPermanenty() -> HttpResponseBuilder`

[src]

####

`pub fn MovedPermanently() -> HttpResponseBuilder`

[src]

####

`pub fn Found() -> HttpResponseBuilder`

[src]

####

`pub fn SeeOther() -> HttpResponseBuilder`

[src]

####

`pub fn NotModified() -> HttpResponseBuilder`

[src]

####

`pub fn UseProxy() -> HttpResponseBuilder`

[src]

####

`pub fn TemporaryRedirect() -> HttpResponseBuilder`

[src]

####

`pub fn PermanentRedirect() -> HttpResponseBuilder`

[src]

####

`pub fn BadRequest() -> HttpResponseBuilder`

[src]

####

`pub fn NotFound() -> HttpResponseBuilder`

[src]

####

`pub fn Unauthorized() -> HttpResponseBuilder`

[src]

####

`pub fn PaymentRequired() -> HttpResponseBuilder`

[src]

####

`pub fn Forbidden() -> HttpResponseBuilder`

[src]

####

`pub fn MethodNotAllowed() -> HttpResponseBuilder`

[src]

####

`pub fn NotAcceptable() -> HttpResponseBuilder`

[src]

####

`pub fn ProxyAuthenticationRequired() -> HttpResponseBuilder`

[src]

####

`pub fn RequestTimeout() -> HttpResponseBuilder`

[src]

####

`pub fn Conflict() -> HttpResponseBuilder`

[src]

####

`pub fn Gone() -> HttpResponseBuilder`

[src]

####

`pub fn LengthRequired() -> HttpResponseBuilder`

[src]

####

`pub fn PreconditionFailed() -> HttpResponseBuilder`

[src]

####

`pub fn PayloadTooLarge() -> HttpResponseBuilder`

[src]

####

`pub fn UriTooLong() -> HttpResponseBuilder`

[src]

####

`pub fn UnsupportedMediaType() -> HttpResponseBuilder`

[src]

####

`pub fn RangeNotSatisfiable() -> HttpResponseBuilder`

[src]

####

`pub fn ExpectationFailed() -> HttpResponseBuilder`

[src]

####

`pub fn InternalServerError() -> HttpResponseBuilder`

[src]

####

`pub fn NotImplemented() -> HttpResponseBuilder`

[src]

####

`pub fn BadGateway() -> HttpResponseBuilder`

[src]

####

`pub fn ServiceUnavailable() -> HttpResponseBuilder`

[src]

####

`pub fn GatewayTimeout() -> HttpResponseBuilder`

[src]

####

`pub fn VersionNotSupported() -> HttpResponseBuilder`

[src]

####

`pub fn VariantAlsoNegotiates() -> HttpResponseBuilder`

[src]

####

`pub fn InsufficientStorage() -> HttpResponseBuilder`

[src]

####

`pub fn LoopDetected() -> HttpResponseBuilder`

[src]

###

`impl HttpResponse`

[src]

####

`pub fn build(status: StatusCode) -> HttpResponseBuilder`

[src]

Create http response builder with specific status.

####

`pub fn build_from<T: Into<HttpResponseBuilder>>( source: T ) -> HttpResponseBuilder`

[src]

Create http response builder

####

`pub fn new(status: StatusCode) -> HttpResponse`

[src]

Constructs a response

####

`pub fn with_body<B: Into<Body>>(status: StatusCode, body: B) -> HttpResponse`

[src]

Constructs a response with body

####

`pub fn from_error(error: Error) -> HttpResponse`

[src]

Constructs an error response

####

`pub fn into_builder(self) -> HttpResponseBuilder`

[src]

Convert `HttpResponse` to a `HttpResponseBuilder`

####

`pub fn error(&self) -> Option<&Error>`

[src]

The source `error` for this response

####

`pub fn version(&self) -> Option<Version>`

[src]

Get the HTTP version of this response

####

`pub fn headers(&self) -> &HeaderMap`

[src]

Get the headers from the response

####

`pub fn headers_mut(&mut self) -> &mut HeaderMap`

[src]

Get a mutable reference to the headers

####

`pub fn cookies(&self) -> CookieIter`

[src]

Get an iterator for the cookies set by this response

####

`pub fn add_cookie(&mut self, cookie: &Cookie) -> Result<(), HttpError>`

[src]

Add a cookie to this response

####

`pub fn del_cookie(&mut self, name: &str) -> usize`

[src]

Remove all cookies with the given name from this response. Returns the number of cookies removed.

####

`pub fn status(&self) -> StatusCode`

[src]

Get the response status code

####

`pub fn status_mut(&mut self) -> &mut StatusCode`

[src]

Set the `StatusCode` for this response

####

`pub fn reason(&self) -> &str`

[src]

Get custom reason for the response

####

`pub fn set_reason(&mut self, reason: &'static str) -> &mut Self`

[src]

Set the custom reason for the response

####

`pub fn set_connection_type(&mut self, conn: ConnectionType) -> &mut Self`

[src]

Set connection type

####

`pub fn upgrade(&self) -> bool`

[src]

Connection upgrade status

####

`pub fn keep_alive(&self) -> Option<bool>`

[src]

Keep-alive status for this connection

####

`pub fn chunked(&self) -> Option<bool>`

[src]

is chunked encoding enabled

####

`pub fn content_encoding(&self) -> Option<ContentEncoding>`

[src]

Content encoding

####

`pub fn set_content_encoding(&mut self, enc: ContentEncoding) -> &mut Self`

[src]

Set content encoding

####

`pub fn body(&self) -> &Body`

[src]

Get body os this response

####

`pub fn set_body<B: Into<Body>>(&mut self, body: B)`

[src]

Set a body

####

`pub fn replace_body<B: Into<Body>>(&mut self, body: B) -> Body`

[src]

Set a body and return previous body value

####

`pub fn response_size(&self) -> u64`

[src]

Size of response in bytes, excluding HTTP headers

####

`pub fn write_buffer_capacity(&self) -> usize`

[src]

Get write buffer capacity

####

`pub fn set_write_buffer_capacity(&mut self, cap: usize)`

[src]

Set write buffer capacity

## Trait Implementations

###

`impl Responder for HttpResponse`

[src]

#### `type Item = AsyncResult<HttpResponse>`

The associated item which can be returned.

#### `type Error = Error`

The associated error which can be returned.

####

`fn respond_to<S>( self, _: &HttpRequest<S> ) -> Result<AsyncResult<HttpResponse>, Error>`

[src]

Convert itself to `AsyncResult` or `Error`.

###

`impl<I: Into<HttpResponse>, E: Into<Error>> From<Result<I, E>> for HttpResponse`

[src]

Helper converters

####

`fn from(res: Result<I, E>) -> Self`

[src]

Performs the conversion.

###

`impl From<HttpResponseBuilder> for HttpResponse`

[src]

####

`fn from(builder: HttpResponseBuilder) -> Self`

[src]

Performs the conversion.

###

`impl From<&'static str> for HttpResponse`

[src]

####

`fn from(val: &'static str) -> Self`

[src]

Performs the conversion.

###

`impl From<&'static [u8]> for HttpResponse`

[src]

####

`fn from(val: &'static [u8]) -> Self`

[src]

Performs the conversion.

###

`impl From<String> for HttpResponse`

[src]

####

`fn from(val: String) -> Self`

[src]

Performs the conversion.

###

`impl<'a> From<&'a String> for HttpResponse`

[src]

####

`fn from(val: &'a String) -> Self`

[src]

Performs the conversion.

###

`impl From<Bytes> for HttpResponse`

[src]

####

`fn from(val: Bytes) -> Self`

[src]

Performs the conversion.

###

`impl From<BytesMut> for HttpResponse`

[src]

####

`fn from(val: BytesMut) -> Self`

[src]

Performs the conversion.

###

`impl From<Error> for HttpResponse`

[src]

Convert `Error` to a `HttpResponse` instance

####

`fn from(err: Error) -> Self`

[src]

Performs the conversion.

###

`impl Debug for HttpResponse`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

###

`impl !Send for HttpResponse`

###

`impl !Sync for HttpResponse`

## Blanket Implementations

###

`impl<T> From for T`

[src]

####

`fn from(t: T) -> T`

[src]

Performs the conversion.

###

`impl<T, U> Into for T where U: From<T>,`

[src]

####

`fn into(self) -> U`

[src]

Performs the conversion.

###

`impl<T, U> TryFrom for T where T: From<U>,`

[src]

#### `type Error = !`

🔬 This is a nightly-only experimental API. (`try_from`)

The type returned in the event of a conversion error.

####

`fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`

[src]

🔬 This is a nightly-only experimental API. (`try_from`)

Performs the conversion.

###

`impl<T> Borrow for T where T: ?Sized,`

[src]

####

`fn borrow(&self) -> &T`

[src]

Immutably borrows from an owned value. Read more

###

`impl<T> BorrowMut for T where T: ?Sized,`

[src]

####

`fn borrow_mut(&mut self) -> &mut T`

[src]

Mutably borrows from an owned value. Read more

###

`impl<T, U> TryInto for T where U: TryFrom<T>,`

[src]

#### `type Error = <U as TryFrom<T>>::Error`

🔬 This is a nightly-only experimental API. (`try_from`)

The type returned in the event of a conversion error.

####

`fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`

[src]

🔬 This is a nightly-only experimental API. (`try_from`)

Performs the conversion.

###

`impl<T> Any for T where T: 'static + ?Sized,`

[src]

####

`fn get_type_id(&self) -> TypeId`

[src]

🔬 This is a nightly-only experimental API. (`get_type_id`)

this method will likely be replaced by an associated static

Gets the `TypeId` of `self`. Read more

###

`impl<T> Erased for T`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)