Skip to content

Instantly share code, notes, and snippets.

@jamesward
Last active October 7, 2020 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesward/4934376eecb1fe2230b9da0690a3c43e to your computer and use it in GitHub Desktop.
Save jamesward/4934376eecb1fe2230b9da0690a3c43e to your computer and use it in GitHub Desktop.
case class WSRequest(url: String, headers: Map[String, String] = Map.empty) {
def withHeaders(_headers: (String, String)*): WSRequest = {
copy(headers = Map.from(_headers))
}
}
val r0 = WSRequest("asdf", Map("foo" -> "bar"))
val r1 = WSRequest("asdf")
val r2 = r1.withHeaders("foo" -> "bar") // syntactic sugar for r1.copy(headers = ...)
(r0 == r2) == true
(r1 == r2) == false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment