bodyStr property
Retrieves the body as a String.
The empty string is returned if there is no body.
Throws a FormatException
if the body contains a sequence of bytes that
do not represent a UTF-8 encoded code point.
Use bodyBytes to retrieve the body as a sequence of bytes.
Implementation
String get bodyStr {
if (_bodyStr != null) {
assert(_bodyBytes == null, 'both _bodyBytes and _bodyStr are set');
return _bodyStr;
} else if (_bodyBytes != null) {
return utf8.decode(_bodyBytes, allowMalformed: false);
} else {
return ''; // empty String
}
}