---
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) &gt; [@loopback/testlab](./testlab.md) &gt; [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 &amp; cert when `protocol` is set to `https`<!-- -->.

**Signature:**

```typescript
export declare function givenHttpServerConfig<T extends HttpOptions | HttpsOptions>(customConfig?: T): HostPort & T;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

customConfig


</td><td markdown="1">

T


</td><td markdown="1">

_(Optional)_ Additional configuration options to apply.


</td></tr>
</tbody></table>

**Returns:**

[HostPort](./testlab.hostport.md) &amp; T


