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

# HCMockSetMockMatchedCallback

> Registers a callback that's invoked when the specified mock is matched.

Add an intermediate callback that will be called when the specified mock is matched. This gives the client another opportunity to specify the mock response.

## Syntax

```cpp theme={null}
HRESULT HCMockSetMockMatchedCallback(  
         HCMockCallHandle call,  
         HCMockMatchedCallback callback,  
         void* context  
)  
```

### Parameters

*call*   \_In\_\
Type: HCMockCallHandle

The matched mock.

*callback*   \_In\_\
Type: [HCMockMatchedCallback](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockmatchedcallback.md)

Callback to be invoked when the mock is matched.

*context*   \_In\_opt\_\
Type: void\*

Client context.

### Return value

Type: HRESULT

Result code for this API operation. Possible values are S\_OK, E\_INVALIDARG, or E\_FAIL.

## Remarks

libHttpClient invokes the callback when a request attempt matches the mock, before it copies the mock response to the attempt. The callback runs on a thread that dispatches the work port of the task queue for the call. For details, see [HCMockMatchedCallback](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockmatchedcallback.md).

## Requirements

**Header:** mock.h

**Library:** libHttpClient.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[mock](https://docs.xbox.com/reference/live/httpclient/mock/mock_members.md)\
[HCMockMatchedCallback](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockmatchedcallback.md)\
[HCMockAddMock](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockaddmock.md)


## Related topics

- [HCMockMatchedCallback](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockmatchedcallback.md)
- [mock (contents)](https://docs.xbox.com/reference/live/httpclient/mock/mock_members.md)
- [HCMockAddMock](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockaddmock.md)
- [HCMockRemoveMock](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockremovemock.md)
- [HCMockClearMocks](https://docs.xbox.com/reference/live/httpclient/mock/functions/hcmockclearmocks.md)
