---
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.

<b>Signature:</b>

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

## Parameters

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

<b>Returns:</b>

[Client](./testlab.client.md)


