# Response

<a id="response-3"></a>

# Response

```cpp
#include <icy/http/response.h>

class Response
```

[Defined in src/http/include/icy/http/response.h:78](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L78)

> **Inherits:** [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1)

HTTP response message with status, reason phrase, headers, and body metadata.

## List of all members

| Name | Kind | Owner |
|------|------|-------|
| [`operator<<`](#operator-207) | `friend` | Declared here |
| [`Response`](#response-4) | `function` | Declared here |
| [`Response`](#response-5) | `function` | Declared here |
| [`Response`](#response-6) | `function` | Declared here |
| [`Response`](#response-7) | `function` | Declared here |
| [`Response`](#response-8) | `function` | Declared here |
| [`~Response`](#response-9) | `function` | Declared here |
| [`setStatus`](#setstatus) | `function` | Declared here |
| [`getStatus`](#getstatus) | `function` | Declared here |
| [`setReason`](#setreason) | `function` | Declared here |
| [`getReason`](#getreason) | `function` | Declared here |
| [`setStatusAndReason`](#setstatusandreason) | `function` | Declared here |
| [`setDate`](#setdate) | `function` | Declared here |
| [`getDate`](#getdate) | `function` | Declared here |
| [`addCookie`](#addcookie) | `function` | Declared here |
| [`getCookies`](#getcookies-1) | `function` | Declared here |
| [`write`](#write-30) | `function` | Declared here |
| [`write`](#write-31) | `function` | Declared here |
| [`write`](#write-32) | `function` | Declared here |
| [`success`](#success) | `function` | Declared here |
| [`_status`](#_status) | `variable` | Declared here |
| [`_reason`](#_reason) | `variable` | Declared here |
| [`setVersion`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setversion-1) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`getVersion`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getversion-1) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`setContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setcontentlength) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`getContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getcontentlength) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`hasContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#hascontentlength) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`setTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#settransferencoding) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`getTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#gettransferencoding) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`setChunkedTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setchunkedtransferencoding) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`isChunkedTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#ischunkedtransferencoding) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`setContentType`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setcontenttype) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`getContentType`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getcontenttype) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`setKeepAlive`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setkeepalive-1) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`getKeepAlive`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getkeepalive) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-24) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-25) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-26) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`HTTP_1_0`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#http_1_0) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`HTTP_1_1`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#http_1_1) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`IDENTITY_TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#identity_transfer_encoding) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CHUNKED_TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#chunked_transfer_encoding) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`UNKNOWN_CONTENT_LENGTH`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#unknown_content_length) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`UNKNOWN_CONTENT_TYPE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#unknown_content_type) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CONTENT_LENGTH`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#content_length) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CONTENT_TYPE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#content_type) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#transfer_encoding) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CONNECTION`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection-7) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CONNECTION_KEEP_ALIVE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection_keep_alive) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`CONNECTION_CLOSE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection_close) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`EMPTY`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#empty-4) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`_version`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#_version-1) | `variable` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-2) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-3) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`~Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-4) | `function` | Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) |
| [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-1) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-2) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-3) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`~NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-4) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`operator=`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-64) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`operator=`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-65) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`operator[]`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-66) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`set`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#set-1) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`add`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#add-4) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`add`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#add-5) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`get`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#get-7) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`get`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#get-8) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`has`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#has-2) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`find`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#find) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`begin`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#begin-5) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`end`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#end-2) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`empty`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#empty-2) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`size`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#size-5) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`erase`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#erase-1) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`clear`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#clear-3) | `function` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`Map`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#map-6) | `typedef` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`Iterator`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#iterator) | `typedef` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`ConstIterator`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#constiterator) | `typedef` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |
| [`_map`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#_map-2) | `variable` | Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) |

## Inherited from [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1)

| Kind | Name | Description |
|------|------|-------------|
| `function` | [`setVersion`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setversion-1)  | Sets the HTTP version for this message. |
| `function` | [`getVersion`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getversion-1) `const` | Returns the HTTP version for this message. |
| `function` | [`setContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setcontentlength)  | Sets the Content-Length header. |
| `function` | [`getContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getcontentlength) `const` | Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present. |
| `function` | [`hasContentLength`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#hascontentlength) `const` | Returns true if a Content-Length header is present. |
| `function` | [`setTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#settransferencoding)  | Sets the transfer encoding for this message. |
| `function` | [`getTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#gettransferencoding) `const` | Returns the transfer encoding used for this message. |
| `function` | [`setChunkedTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setchunkedtransferencoding)  | If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header. |
| `function` | [`isChunkedTransferEncoding`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#ischunkedtransferencoding) `const` | Returns true if the Transfer-Encoding header is set and its value is chunked. |
| `function` | [`setContentType`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setcontenttype)  | Sets the content type for this message. |
| `function` | [`getContentType`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getcontenttype) `const` | Returns the content type for this message. |
| `function` | [`setKeepAlive`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#setkeepalive-1)  | Sets the value of the [Connection](https://auscaster.com/icey/docs/api-reference/icy-http-Connection.md#connection-1) header field. |
| `function` | [`getKeepAlive`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#getkeepalive) `const` | Returns true if |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-24) `virtual` `const` | Writes the message header to the given output stream. |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-25) `virtual` `const` | Writes the message header to the given output string. |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-26) `virtual` `const` | Writes the message header directly into a byte buffer. |
| `variable` | [`HTTP_1_0`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#http_1_0) `static` |  |
| `variable` | [`HTTP_1_1`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#http_1_1) `static` |  |
| `variable` | [`IDENTITY_TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#identity_transfer_encoding) `static` |  |
| `variable` | [`CHUNKED_TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#chunked_transfer_encoding) `static` |  |
| `variable` | [`UNKNOWN_CONTENT_LENGTH`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#unknown_content_length) `static` |  |
| `variable` | [`UNKNOWN_CONTENT_TYPE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#unknown_content_type) `static` |  |
| `variable` | [`CONTENT_LENGTH`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#content_length) `static` |  |
| `variable` | [`CONTENT_TYPE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#content_type) `static` |  |
| `variable` | [`TRANSFER_ENCODING`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#transfer_encoding) `static` |  |
| `variable` | [`CONNECTION`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection-7) `static` |  |
| `variable` | [`CONNECTION_KEEP_ALIVE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection_keep_alive) `static` |  |
| `variable` | [`CONNECTION_CLOSE`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#connection_close) `static` |  |
| `variable` | [`EMPTY`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#empty-4) `static` |  |
| `variable` | [`_version`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#_version-1)  |  |
| `function` | [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-2)  | Creates the [Message](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) with version HTTP/1.0. |
| `function` | [`Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-3)  | Creates the [Message](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1) and sets the version. |
| `function` | [`~Message`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-4) `virtual` | Destroys the [Message](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#message-1). |

## Inherited from [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection)

| Kind | Name | Description |
|------|------|-------------|
| `function` | [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-1) `inline` |  |
| `function` | [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-2) `inline` |  |
| `function` | [`NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-3) `inline` `noexcept` |  |
| `function` | [`~NVCollection`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection-4) `virtual` `inline` |  |
| `function` | [`operator=`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-64)  | Assigns the name-value pairs of another [NVCollection](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#nvcollection) to this one. |
| `function` | [`operator=`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-65) `noexcept` |  |
| `function` | [`operator[]`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#operator-66) `const` | Returns the value of the (first) name-value pair with the given name. |
| `function` | [`set`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#set-1)  | Sets the value of the (first) name-value pair with the given name. |
| `function` | [`add`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#add-4)  | Adds a new name-value pair with the given name and value. |
| `function` | [`add`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#add-5)  | Adds a new name-value pair using move semantics. |
| `function` | [`get`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#get-7) `const` | Returns the value of the first name-value pair with the given name. |
| `function` | [`get`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#get-8) `const` | Returns the value of the first name-value pair with the given name. If no value with the given name has been found, the defaultValue is returned. |
| `function` | [`has`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#has-2) `const` | Returns true if there is at least one name-value pair with the given name. |
| `function` | [`find`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#find) `const` | Returns an iterator pointing to the first name-value pair with the given name. |
| `function` | [`begin`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#begin-5) `const` | Returns an iterator pointing to the begin of the name-value pair collection. |
| `function` | [`end`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#end-2) `const` | Returns an iterator pointing to the end of the name-value pair collection. |
| `function` | [`empty`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#empty-2) `const` | Returns true iff the header does not have any content. |
| `function` | [`size`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#size-5) `const` | Returns the number of name-value pairs in the collection. |
| `function` | [`erase`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#erase-1)  | Removes all name-value pairs with the given name. |
| `function` | [`clear`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#clear-3)  | Removes all name-value pairs and their values. |
| `typedef` | [`Map`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#map-6)  |  |
| `typedef` | [`Iterator`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#iterator)  |  |
| `typedef` | [`ConstIterator`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#constiterator)  |  |
| `variable` | [`_map`](https://auscaster.com/icey/docs/api-reference/icy-NVCollection.md#_map-2)  |  |

## Friends

| Name | Description |
|------|-------------|
| [`operator<<`](#operator-207) `inline` |  |

---

<a id="operator-207"></a>

### operator<<

`inline`

```cpp
friend inline std::ostream & operator<<(std::ostream & stream, const Response & res)
```

[Defined in src/http/include/icy/http/response.h:145](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L145)

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`Response`](#response-4)  | Creates the [Response](#response-3) with OK status. |
|  | [`Response`](#response-5)  | Creates the [Response](#response-3) with the given status and reason phrase. |
|  | [`Response`](#response-6)  | Creates the [Response](#response-3) with the given version, status and reason phrase. |
|  | [`Response`](#response-7)  | Creates the [Response](#response-3) with the given status and an appropriate reason phrase. |
|  | [`Response`](#response-8)  | Creates the [Response](#response-3) with the given version, status and an appropriate reason phrase. |
|  | [`~Response`](#response-9) `virtual` | Destroys the [Response](#response-3). |
| `void` | [`setStatus`](#setstatus)  | Sets the HTTP status code. |
| [`StatusCode`](https://auscaster.com/icey/docs/api-reference/icy-http.md#statuscode) | [`getStatus`](#getstatus) `const` | Returns the HTTP status code. |
| `void` | [`setReason`](#setreason)  | Sets the HTTP reason phrase. |
| `const std::string &` | [`getReason`](#getreason) `const` | Returns the HTTP reason phrase. |
| `void` | [`setStatusAndReason`](#setstatusandreason)  | Sets the HTTP status code and reason phrase. |
| `void` | [`setDate`](#setdate)  | Sets the Date header to the given date/time value. |
| [`Timestamp`](https://auscaster.com/icey/docs/api-reference/icy-Timestamp.md#timestamp-2) | [`getDate`](#getdate) `const` | Returns the value of the Date header. |
| `void` | [`addCookie`](#addcookie)  | Adds the cookie to the response by adding a Set-Cookie header. |
| `void` | [`getCookies`](#getcookies-1) `const` | Returns a vector with all the cookies set in the response header. |
| `void` | [`write`](#write-30) `virtual` `const` | Writes the HTTP response headers to the given output stream. |
| `void` | [`write`](#write-31) `virtual` `const` | Writes the HTTP response headers to the given output string. |
| `void` | [`write`](#write-32) `virtual` `const` | Writes the HTTP response headers directly into a byte buffer. |
| `bool` | [`success`](#success) `virtual` `const` | Returns true if the HTTP response code was successful (< 400). |

---

<a id="response-4"></a>

### Response

```cpp
Response()
```

[Defined in src/http/include/icy/http/response.h:82](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L82)

Creates the [Response](#response-3) with OK status.

---

<a id="response-5"></a>

### Response

```cpp
Response(StatusCode status, const std::string & reason)
```

[Defined in src/http/include/icy/http/response.h:85](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L85)

Creates the [Response](#response-3) with the given status and reason phrase.

---

<a id="response-6"></a>

### Response

```cpp
Response(const std::string & version, StatusCode status, const std::string & reason)
```

[Defined in src/http/include/icy/http/response.h:88](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L88)

Creates the [Response](#response-3) with the given version, status and reason phrase.

---

<a id="response-7"></a>

### Response

```cpp
Response(StatusCode status)
```

[Defined in src/http/include/icy/http/response.h:92](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L92)

Creates the [Response](#response-3) with the given status and an appropriate reason phrase.

---

<a id="response-8"></a>

### Response

```cpp
Response(const std::string & version, StatusCode status)
```

[Defined in src/http/include/icy/http/response.h:96](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L96)

Creates the [Response](#response-3) with the given version, status and an appropriate reason phrase.

---

<a id="response-9"></a>

### ~Response

`virtual`

```cpp
virtual ~Response()
```

[Defined in src/http/include/icy/http/response.h:99](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L99)

Destroys the [Response](#response-3).

---

<a id="setstatus"></a>

### setStatus

```cpp
void setStatus(StatusCode status)
```

[Defined in src/http/include/icy/http/response.h:104](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L104)

Sets the HTTP status code.

The reason phrase is set according to the status code.

---

<a id="getstatus"></a>

### getStatus

`const`

```cpp
StatusCode getStatus() const
```

[Defined in src/http/include/icy/http/response.h:107](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L107)

Returns the HTTP status code.

---

<a id="setreason"></a>

### setReason

```cpp
void setReason(const std::string & reason)
```

[Defined in src/http/include/icy/http/response.h:110](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L110)

Sets the HTTP reason phrase.

---

<a id="getreason"></a>

### getReason

`const`

```cpp
const std::string & getReason() const
```

[Defined in src/http/include/icy/http/response.h:113](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L113)

Returns the HTTP reason phrase.

---

<a id="setstatusandreason"></a>

### setStatusAndReason

```cpp
void setStatusAndReason(StatusCode status, const std::string & reason)
```

[Defined in src/http/include/icy/http/response.h:116](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L116)

Sets the HTTP status code and reason phrase.

---

<a id="setdate"></a>

### setDate

```cpp
void setDate(const Timestamp & dateTime)
```

[Defined in src/http/include/icy/http/response.h:119](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L119)

Sets the Date header to the given date/time value.

---

<a id="getdate"></a>

### getDate

`const`

```cpp
Timestamp getDate() const
```

[Defined in src/http/include/icy/http/response.h:122](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L122)

Returns the value of the Date header.

---

<a id="addcookie"></a>

### addCookie

```cpp
void addCookie(const Cookie & cookie)
```

[Defined in src/http/include/icy/http/response.h:126](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L126)

Adds the cookie to the response by adding a Set-Cookie header.

---

<a id="getcookies-1"></a>

### getCookies

`const`

```cpp
void getCookies(std::vector< Cookie > & cookies) const
```

[Defined in src/http/include/icy/http/response.h:131](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L131)

Returns a vector with all the cookies set in the response header.

May throw an exception in case of a malformed Set-Cookie header.

---

<a id="write-30"></a>

### write

`virtual` `const`

```cpp
virtual void write(std::ostream & ostr) const
```

[Defined in src/http/include/icy/http/response.h:134](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L134)

Writes the HTTP response headers to the given output stream.

#### Reimplements

- [`Message::write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-24)

---

<a id="write-31"></a>

### write

`virtual` `const`

```cpp
virtual void write(std::string & str) const
```

[Defined in src/http/include/icy/http/response.h:137](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L137)

Writes the HTTP response headers to the given output string.

#### Reimplements

- [`Message::write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-25)

---

<a id="write-32"></a>

### write

`virtual` `const`

```cpp
virtual void write(Buffer & buf) const
```

[Defined in src/http/include/icy/http/response.h:140](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L140)

Writes the HTTP response headers directly into a byte buffer.

#### Reimplements

- [`Message::write`](https://auscaster.com/icey/docs/api-reference/icy-http-Message.md#write-26)

---

<a id="success"></a>

### success

`virtual` `const`

```cpp
virtual bool success() const
```

[Defined in src/http/include/icy/http/response.h:143](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L143)

Returns true if the HTTP response code was successful (< 400).

## Private Attributes

| Return | Name | Description |
|--------|------|-------------|
| [`StatusCode`](https://auscaster.com/icey/docs/api-reference/icy-http.md#statuscode) | [`_status`](#_status)  |  |
| `std::string` | [`_reason`](#_reason)  |  |

---

<a id="_status"></a>

### _status

```cpp
StatusCode _status
```

Type: [`StatusCode`](https://auscaster.com/icey/docs/api-reference/icy-http.md#statuscode)

[Defined in src/http/include/icy/http/response.h:152](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L152)

---

<a id="_reason"></a>

### _reason

```cpp
std::string _reason
```

[Defined in src/http/include/icy/http/response.h:153](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/response.h#L153)
