The response body decoded as String, using a simple algorithm to guess the encoding.
The response body decoded as String, using a simple algorithm to guess the encoding.
This decodes the body to a string representation based on the following algorithm:
charset
to its value and go to step 3.
2. If the Content-Type is of type "text", set charset to "ISO-8859-1"; else set charset
to "UTF-8".
3. Decode the raw bytes of the body using charset
.Note that this does not take into account any special cases for specific content types. For example, for application/json, we do not support encoding autodetection and will trust the charset parameter if provided..
the response body parsed as a String using the above algorithm.
The response body as ByteString.
the response as a source of bytes
Get only one cookie, using the cookie name.
Get all the cookies.
Returns the current headers for this response.
The response status code.
The response status message.
Get the underlying response object.
Returns the URI for this response, which can differ from the request one in case of redirection.
The response body as the given type.
The response body as the given type. This renders as the given type. You must have a BodyReadable in implicit scope.
The simplest use case is
val responseBodyAsString: String = response.body[String]
But you can also render as JSON
val responseBodyAsJson: JsValue = response.body[JsValue]
or as XML:
val responseBodyAsByteString: ByteString = response.body[ByteString]
the content type.
Get the value of the header with the specified name.
Get the value of the header with the specified name. If there are more than one values for this header, the first value is returned. If there are no values, than a None is returned.
the header name
the header value
Get all the values of header with the specified name.
Get all the values of header with the specified name. If there are no values for the header with the specified name, than an empty sequence is returned.
the header name.
all the values for this header name.
A WS HTTP response.