AddHeaders method

  1. @override
void AddHeaders(
  1. WebHeaderCollection? webHeaderCollection
)
override
Adds header values to the request The request web header collection

Implementation

@override
void AddHeaders(WebHeaderCollection? webHeaderCollection) {
  // Check if the ETag was specified
  if (!StringUtils.IsNullOrEmpty(EntityTag)) {
    // Ensure the ETag is wrapped in quotes
    String quotedETag = EntityTag!;
    if (!EntityTag!.startsWith("\"")) {
      quotedETag = "\"$quotedETag";
    }

    if (!EntityTag!.endsWith("\"")) {
      quotedETag = "$quotedETag\"";
    }

    webHeaderCollection![HttpHeaders.ifNoneMatchHeader] = quotedETag;
  }
}