methodSupportsBody method

bool methodSupportsBody(
  1. String method
)

Implementation

bool methodSupportsBody(String method) {
  // According to HTTP/1.1 (RFC 7231), the following methods should not be allowed by servers: https://www.rfc-editor.org/rfc/rfc7231
  const methodsWithoutBody = {
    'GET',
    'HEAD',
    'DELETE',
    'CONNECT',
    'OPTIONS',
    'TRACE',
  };

  return !methodsWithoutBody.contains(method.toUpperCase());
}