---
title: "ServerResponse"
sidebar_label: "ServerResponse"
description: "Kotlin binding reference: ServerResponse."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[ServerResponse](index.md)

# ServerResponse

[common]\
class [ServerResponse](index.md)

A response a handler answers, built by a factory and chained with [withHeader](withHeader.md) / [withCookie](withCookie.md). Returning it from a handler consumes it; a response never returned is released by [close](close.md).

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [withCookie](withCookie.md) | [common]<br>fun [withCookie](withCookie.md)(cookie: [Cookie](../Cookie/index.md)): [ServerResponse](index.md)<br>Set a cookie (a Set-Cookie header). Returns this for chaining. |
| [withHeader](withHeader.md) | [common]<br>fun [withHeader](withHeader.md)(name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), value: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [ServerResponse](index.md)<br>Append a header (a name may repeat). Returns this for chaining. |