getHttpMethodName function

String? getHttpMethodName(
  1. HttpMethod? method, [
  2. HttpMethod? def
])

Returns method name.

Implementation

String? getHttpMethodName(HttpMethod? method, [HttpMethod? def]) {
  method ??= def!;

  switch (method) {
    case HttpMethod.GET:
      return 'GET';
    case HttpMethod.OPTIONS:
      return 'OPTIONS';
    case HttpMethod.POST:
      return 'POST';
    case HttpMethod.PUT:
      return 'PUT';
    case HttpMethod.DELETE:
      return 'DELETE';
    case HttpMethod.PATCH:
      return 'PATCH';
    case HttpMethod.HEAD:
      return 'HEAD';
    default:
      return null;
  }
}