removeSchemeFromHeaderStr static method

String removeSchemeFromHeaderStr(
  1. String? header,
  2. String scheme
)

Removed the requested scheme from the header

Implementation

static String removeSchemeFromHeaderStr(String? header, String scheme) {
  if (header == null || header.isEmpty) {
    return '';
  }
  AuthHeaders auth = AuthHeaders.fromHeaderStr(header);

  if (auth.isEmpty || !auth.containsScheme(scheme)) {
    return header;
  }

  auth.removeItemByScheme(scheme);

  return auth.toString();
}