For example, the following code will create an extractor for the 2xx group (Status.Success, essentially):
object Success extends Extractor(_.isSuccess)
This can then be used as follows:
val res: Response[ResponseEntity] = ???
// Pattern match against a status
res.status match {
case Success(_) => println("Success")
case _ => println("Not success")
}
// Pattern match against a Response
res match {
case Success(_) => println("Success")
case _ => println("Not success")
}
Helper for status group extractors.
For example, the following code will create an extractor for the
2xx
group (Status.Success, essentially):This can then be used as follows: