Skip to content

Commit

Permalink
Feature: API to modify headers (#824)
Browse files Browse the repository at this point in the history
* feat(Headers):added new api to update headers

* renamed api
  • Loading branch information
ShrutiVerma97 authored Jan 13, 2022
1 parent 3a34823 commit 66a1dea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zio-http/src/main/scala/zhttp/http/Headers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ final case class Headers(toChunk: Chunk[Header]) extends HeaderExtension[Headers

def toList: List[(String, String)] = toChunk.map { case (name, value) => (name.toString, value.toString) }.toList

def modify(f: Header => Header): Headers = Headers(toChunk.map(f(_)))

override def updateHeaders(update: Headers => Headers): Headers = update(self)

def when(cond: Boolean): Headers = if (cond) self else Headers.empty
Expand Down

0 comments on commit 66a1dea

Please sign in to comment.