> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# ResponseCapture

> Captures HTTP responses from named requests for use in request chaining.

## Definition

**Assembly:** CloudNimble.Breakdance.DotHttp.dll

**Namespace:** CloudNimble.Breakdance.DotHttp

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
CloudNimble.Breakdance.DotHttp.ResponseCapture
```

## Summary

Captures HTTP responses from named requests for use in request chaining.

## Remarks

Supports `{{name.response.body.$.path}}` for JSONPath, `{{name.response.body./xpath}}` for XPath,
and `{{name.response.headers.HeaderName}}` for header extraction.

## Examples

```csharp theme={"dark"}
var capture = new ResponseCapture();
await capture.CaptureAsync("login", loginResponse);

// Later, resolve a reference from the captured response
var token = capture.ResolveReference("{{login.response.body.$.token}}");
var header = capture.ResolveReference("{{login.response.headers.X-Request-Id}}");
```

## Constructors

### &#x20;.ctor

#### Syntax

```csharp theme={"dark"}
public ResponseCapture()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Methods

### &#x20;CaptureAsync

Captures a response for later reference.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.Task CaptureAsync(string name, System.Net.Http.HttpResponseMessage response, string requestBody = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `name` | `string` | The request name (from # @name directive). |
| `response` | `System.Net.Http.HttpResponseMessage` | The HTTP response. |
| `requestBody` | `string` | The original request body (for `{{name.request.body}}` references). |

#### Returns

Type: `System.Threading.Tasks.Task`

#### Examples

```csharp theme={"dark"}
var capture = new ResponseCapture();
var response = await httpClient.SendAsync(request);
await capture.CaptureAsync("createUser", response, requestBodyJson);
```

### &#x20;Clear

Clears all captured responses.

#### Syntax

```csharp theme={"dark"}
public void Clear()
```

#### Examples

```csharp theme={"dark"}
var capture = new ResponseCapture();
// ... capture some responses ...
capture.Clear(); // Reset for new test
```

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetResponseBody

Gets the captured response body for a named request.

#### Syntax

```csharp theme={"dark"}
public string GetResponseBody(string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `name` | `string` | The request name. |

#### Returns

Type: `string`
The response body, or null if not captured.

#### Examples

```csharp theme={"dark"}
var capture = new ResponseCapture();
await capture.CaptureAsync("login", response);
var body = capture.GetResponseBody("login");
```

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;HasResponse

Checks if a captured response exists for the given name.

#### Syntax

```csharp theme={"dark"}
public bool HasResponse(string name)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `name` | `string` | The request name. |

#### Returns

Type: `bool`
True if the response has been captured.

#### Examples

```csharp theme={"dark"}
if (capture.HasResponse("login"))
{
    var token = capture.ResolveReference("{{login.response.body.$.token}}");
}
```

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ResolveAllReferences

Resolves all response references in a string.

#### Syntax

```csharp theme={"dark"}
public string ResolveAllReferences(string input)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `input` | `string` | The input string containing response references. |

#### Returns

Type: `string`
The resolved string.

#### Examples

```csharp theme={"dark"}
var url = "https://api.example.com/users/{{login.response.body.$.userId}}";
var resolvedUrl = capture.ResolveAllReferences(url);
```

### &#x20;ResolveReference

Resolves a response reference to its actual value.

#### Syntax

```csharp theme={"dark"}
public string ResolveReference(string reference)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `reference` | `string` | The full reference string (e.g., `"{{login.response.body.$.token}}"`). |

#### Returns

Type: `string`
The resolved value, or the original reference if not found.

#### Examples

```csharp theme={"dark"}
var capture = new ResponseCapture();
await capture.CaptureAsync("login", response);
var token = capture.ResolveReference("{{login.response.body.$.token}}");
```

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.