-
-
Notifications
You must be signed in to change notification settings - Fork 479
Description
Is your feature request related to a problem? Please describe.
For internal debugging logic of our application (using zio-http as a client), we use the Request Body to generate reproducer queries.
However, since we know the body is already materialized, we don't want to run asString. Instead, we match on the internal zio-http classes:
def body = request.body match {
case asciiBody: AsciiStringBody => asciiBody.asciiString.toString
case default => default.toString
}This is sub-optimal as it can break during upgrades + abuses the zio namespace.
Describe the solution you'd like
Add a method to produce Option[String] for already materialized bodies. IIRC the asciiBody is url encoded, so something like:
def URLEncodedString: Option[String] would be very helpful.
Describe alternatives you've considered
Continue using pattern match on internal classes, or evaluate the toString method.
Additional context
Add any other context or screenshots about the feature request here.