@loopback/docs
Version:
Documentation for LoopBack 4
34 lines (21 loc) • 961 B
Markdown
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) > [@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 | <code>(req: http.IncomingMessage, res: http.ServerResponse) => void</code> | |
<b>Returns:</b>
`Client`