---
title: HeadersRange
summary: Iterates over all headers in a request or response.
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/http/class.HeadersRange/
---

**Kind:** Class  
**Module:** [http](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/http/)  
**Package:** compute-sdk-cpp 0.7.0  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/http/header.h#L71

Include `fastly/http/header.h` to use this class.

Extends `fastly::detail::RustIteratorRange<HeadersRange, fastly::sys::http::HeadersIter>`.

Iterates over all headers in a request or response.

## Methods

### next

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/http/header.h#L79

```cpp
std::optional<std::pair<std::string, HeaderValue>> fastly::http::HeadersRange::next()
```

Gets the next header name and value.

**Returns**

`std::optional<std::pair<std::string, HeaderValue>>`
