body property

  1. @override
Stream<Uint8List> get body
override

The body as a stream of bytes. It can be listened to only once: a second read throws a StateError. On the web starter's server a body above server.max-http-request-body-size ends with a PayloadTooLargeException, whatever its Content-Type (the starter's multipart resolver reads uploads with their own limit, spring.web.multipart.max-request-size). For small bodies, ServerHttpRequestBody.readBodyBytes and ServerHttpRequestBody.readBodyText are simpler.

Implementation

@override
Stream<Uint8List> get body {
  if (_bodyRead) {
    throw StateError('The request body was read already');
  }
  _bodyRead = true;
  return _body.isEmpty ? const Stream.empty() : Stream.value(_body);
}