---
lang: en
title: 'API docs: testlab.createclientforhandler'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/testlab
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.

**Signature:**

```typescript
export declare function createClientForHandler(handler: (req: http.IncomingMessage, res: http.ServerResponse) => void): Client;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

handler


</td><td markdown="1">

(req: http.IncomingMessage, res: http.ServerResponse) =&gt; void


</td><td markdown="1">


</td></tr>
</tbody></table>

**Returns:**

[Client](./testlab.client.md)


