DefaultBodyReadables

play.api.libs.ws.DefaultBodyReadables
See theDefaultBodyReadables companion object

Defines common BodyReadable for a response backed by org.asynchttpclient.Response.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Implicits

Implicits

implicit val readableAsByteArray: BodyReadable[Array[Byte]]

Converts a response body into Array[Byte].

Converts a response body into Array[Byte].

import play.api.libs.ws.DefaultBodyReadables._

def example(response: play.api.libs.ws.StandaloneWSResponse): Array[Byte] =
 response.body[Array[Byte]]

Attributes

implicit val readableAsByteBuffer: BodyReadable[ByteBuffer]

Converts a response body into a read only ByteBuffer.

Converts a response body into a read only ByteBuffer.

import java.nio.ByteBuffer
import play.api.libs.ws.DefaultBodyReadables._

def example(response: play.api.libs.ws.StandaloneWSResponse): ByteBuffer =
 response.body[ByteBuffer]

Attributes

implicit val readableAsByteString: BodyReadable[ByteString]

Converts a response body into an org.apache.pekko.util.ByteString:

Converts a response body into an org.apache.pekko.util.ByteString:

import org.apache.pekko.util.ByteString
import play.api.libs.ws.DefaultBodyReadables._

def example(response: play.api.libs.ws.StandaloneWSResponse): ByteString =
 response.body[ByteString]

Attributes

implicit val readableAsSource: BodyReadable[Source[ByteString, _]]

Converts a response body into Source[ByteString, _].

Converts a response body into Source[ByteString, _].

Attributes

implicit val readableAsString: BodyReadable[String]

Converts a response body into a String.

Converts a response body into a String.

Note: this is only a best-guess effort and does not handle all content types. See StandaloneWSResponse.body:String* for more information.

import play.api.libs.ws.DefaultBodyReadables._

def example(response: play.api.libs.ws.StandaloneWSResponse): String =
 response.body[String]

Attributes