@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
35 lines (22 loc) • 1.25 kB
Markdown
---
lang: en
title: 'API docs: testlab.givenhttpserverconfig'
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.givenhttpserverconfig.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/testlab](./testlab.md) > [givenHttpServerConfig](./testlab.givenhttpserverconfig.md)
## givenHttpServerConfig() function
Create an HTTP-server configuration that works well in test environments. - Ask the operating system to assign a free (ephemeral) port. - Use IPv4 localhost `127.0.0.1` to avoid known IPv6 issues in Docker-based environments like Travis-CI. - Provide default TLS key & cert when `protocol` is set to `https`<!-- -->.
<b>Signature:</b>
```typescript
export declare function givenHttpServerConfig<T extends HttpOptions | HttpsOptions>(customConfig?: T): HostPort & T;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| customConfig | T | Additional configuration options to apply. |
<b>Returns:</b>
[HostPort](./testlab.hostport.md) & T