---
title: "ClikaRT::http::HttpResponse"
sidebar_label: "HttpResponse"
description: "A finished HTTP response, the OUTCOME of a request the server answered. Any answered status is an outcome, not an error: a 404 or 401 arrives here as data, and you branch on status (or ok())."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**Header:** `ClikaRT/http/types.h`

A finished HTTP response, the OUTCOME of a request the server answered. Any answered status is an outcome, not an error: a 404 or 401 arrives here as data, and you branch on [`status`](./HttpResponse.md#status) (or [`ok()`](./HttpResponse.md#ok)). Only a request that could not complete at all (connection, TLS, timeout, cancellation) is an error on the [`Result`](../Result.md) channel. For a fetch that streamed its body elsewhere ([`fetch_file`](./index.md#fetch_file)), [`body`](./HttpResponse.md#body) is empty; status / reason / headers still apply.

## Member functions

### ok() {#ok}

<div class="api-signature">

`bool` **`ok`**() `const noexcept`

</div>

True for a 2xx status.

<div class="api-declared">

Declared in `ClikaRT/http/types.h`, line 66

</div>

## Data members

### status {#status}

<div class="api-signature">

`int` **`status`** `= 0`

</div>

e.g. 200, 404

<div class="api-declared">

Declared in `ClikaRT/http/types.h`, line 60

</div>

### reason {#reason}

<div class="api-signature">

`std::string` **`reason`**

</div>

e.g. "OK", "Not Found"

<div class="api-declared">

Declared in `ClikaRT/http/types.h`, line 61

</div>

### headers {#headers}

<div class="api-signature">

[`Headers`](./Headers.md) **`headers`**

</div>

response headers (case-insensitive bag)

<div class="api-declared">

Declared in `ClikaRT/http/types.h`, line 62

</div>

### body {#body}

<div class="api-signature">

`std::string` **`body`**

</div>

response bytes (empty when streamed elsewhere)

<div class="api-declared">

Declared in `ClikaRT/http/types.h`, line 63

</div>
