@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
35 lines (22 loc) • 1.08 kB
Markdown
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) > [@loopback/testlab](./testlab.md) > [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) => void | |
<b>Returns:</b>
[Client](./testlab.client.md)