Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amitksingh1490 committed Jan 21, 2022
1 parent 6d3a5e9 commit bb5454c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions docs/website/docs/v1.x/dsl/headers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ There are multiple ways to attach headers to a response:
```scala
val app = Http.ok @@ Middleware.addHeader("content-length", "0")
```

### Reading Headers from `Request`

On the Server-side you can read Request headers as given below

```scala
case req @ Method.GET -> !! / "streamOrNot" =>
req.getHeaders
```

<details>
<summary><b>Detailed examples </b></summary>
<p>
Expand Down Expand Up @@ -72,7 +82,7 @@ There are multiple ways to attach headers to a response:

```

- The following example shows how Headers could be added to `Response` in the `Middleware` implementation:
- The following example shows how Headers could be added to `Response` in the `Middleware` implementation:

```scala

Expand All @@ -96,15 +106,6 @@ There are multiple ways to attach headers to a response:
</p>
</details>

### Reading Headers from `Request`

On the Server-side you can read Request headers as given below

```scala
case req @ Method.GET -> !! / "streamOrNot" =>
req.getHeaders
```

## Client-Side

### Adding headers to `Request`
Expand All @@ -116,6 +117,12 @@ val headers = Headers.host("sports.api.decathlon.com").withAccept(HeaderValues.a
val response = Client.request(url, headers)
```

### Reading headers from `Response`

```scala
val responseHeaders: Task[Headers] = Client.request(url).map(_.headers)
```

<details>
<summary><b>Detailed examples</b> </summary>
<p>
Expand Down Expand Up @@ -154,13 +161,6 @@ val response = Client.request(url, headers)
</p>
</details>

### Reading headers from `Response`

```scala
val responseHeaders: Task[Headers] = Client.request(url).map(_.headers)
```


## Headers DSL

Headers DSL provides plenty of powerful operators that can be used to add, remove, modify and verify headers. Headers APIs could be used on client, server, and middleware.
Expand Down

1 comment on commit bb5454c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance Benchmark:

Concurrency: 256
Requests/sec: 934759.37

Please sign in to comment.