Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gciuloaica committed Jan 21, 2022
1 parent 7f1d342 commit 24752b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/website/docs/dsl/headers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ On the server-side, `ZIO-HTTP` is adding a collection of pre-defined headers to

There are multiple ways to attach headers to a response:
- Using `addHeaders` helper on response.
```scala
val res = Response.ok.addHeader("X-MY-HEADER", "test")
```
- Through `Response` constructors.
```scala
val res = Response(
status = Status.OK,
// Setting response header
headers = Headers.contentLength(0L),
data = HttpData.empty
```
- Using `Middlewares`.
```scala
val app = Http.ok @@ Middleware.addHeader("X-MY-HEADER", "test")
```
<details>
<summary>Example below shows how the Headers could be added to a response by using `Response` constructors and how a custom header is added to `Response` through `addHeader` API call: </summary>
<p>
Expand Down

0 comments on commit 24752b7

Please sign in to comment.