takeBody method

Returns the outgoing body on the first call, or null afterwards.

Implementation

WASIPreview2HttpOutgoingBody? takeBody() {
  if (_body != null) {
    return null;
  }
  final contentLength = _contentLength(headers);
  if (contentLength.invalid) {
    return null;
  }
  return _body = WASIPreview2HttpOutgoingBody(
    contentLength: contentLength.value,
  );
}