bodyStr method

Future<String> bodyStr(
  1. int maxBytes
)

The entire body of the request as a string.

The bytes in the body of the HTTP request are interpreted as an UTF-8 encoded string. If the bytes cannot be decoded as UTF-8, a FormatException is thrown.

If the body has more than maxBytes bytes, PostTooLongException is thrown. Set the maxBytes to a value that is not less than the maximum size the request handler ever expects to receive. This limit prevents incorrect/malicious clients from flooding the request handler with too much data in the body (e.g. several gigabytes). To retrieve arbitrarily large bodies, use bodyStream.

Note: the maximum number of characters allowed in the string may be equal to or less than the specified maximum number of bytes. This is because a single Unicode code point may require multiple bytes to represent in UTF-8.

Implementation

Future<String> bodyStr(int maxBytes) => _coreRequest.bodyStr(maxBytes);