hasHeader method

bool hasHeader(
  1. String name
)

Verify the existence of the given header. -param {String} name header name -returns {boolean} true if header with given name exists, false otherwise

Implementation

bool hasHeader(String name) {
  if (headers[utils.headerize(name)]) {
    return true;
  } else {
    RegExp regexp = RegExp('^\\s*$name\\s*:', caseSensitive: false);

    for (dynamic header in extraHeaders) {
      if (regexp.hasMatch(header)) {
        return true;
      }
    }
  }

  return false;
}