diff --git a/docs/website/docs/v1.x/dsl/headers/index.md b/docs/website/docs/v1.x/dsl/headers/index.md index 6ec244325b..0d0efa75d1 100644 --- a/docs/website/docs/v1.x/dsl/headers/index.md +++ b/docs/website/docs/v1.x/dsl/headers/index.md @@ -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 +``` +
Detailed examples

@@ -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 @@ -96,15 +106,6 @@ There are multiple ways to attach headers to a response:

-### 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` @@ -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) +``` +
Detailed examples

@@ -154,13 +161,6 @@ val response = Client.request(url, headers)

-### 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.