---
lang: en
title: 'API docs: testlab.createclientforhandler'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.testlab.createclientforhandler.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/testlab](./testlab.md) &gt; [createClientForHandler](./testlab.createclientforhandler.md)

## createClientForHandler() function

Create a SuperTest client connected to an HTTP server listening on an ephemeral port and calling `handler` to handle incoming requests.

<b>Signature:</b>

```typescript
export declare function createClientForHandler(handler: (req: http.IncomingMessage, res: http.ServerResponse) => void): Client;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  handler | <code>(req: http.IncomingMessage, res: http.ServerResponse) =&gt; void</code> |  |

<b>Returns:</b>

`Client`


