Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Net.Http.Headers
{
Expand All @@ -16,17 +14,8 @@ public sealed class HttpContentHeaders : HttpHeaders
private HttpHeaderValueCollection<string>? _contentEncoding;
private HttpHeaderValueCollection<string>? _contentLanguage;

public ICollection<string> Allow
{
get
{
if (_allow == null)
{
_allow = new HttpHeaderValueCollection<string>(KnownHeaders.Allow.Descriptor, this);
}
return _allow;
}
}
public ICollection<string> Allow =>
_allow ??= new HttpHeaderValueCollection<string>(KnownHeaders.Allow.Descriptor, this);

public ContentDispositionHeaderValue? ContentDisposition
{
Expand All @@ -36,29 +25,11 @@ public ContentDispositionHeaderValue? ContentDisposition

// Must be a collection (and not provide properties like "GZip", "Deflate", etc.) since the
// order matters!
public ICollection<string> ContentEncoding
{
get
{
if (_contentEncoding == null)
{
_contentEncoding = new HttpHeaderValueCollection<string>(KnownHeaders.ContentEncoding.Descriptor, this);
}
return _contentEncoding;
}
}
public ICollection<string> ContentEncoding =>
_contentEncoding ??= new HttpHeaderValueCollection<string>(KnownHeaders.ContentEncoding.Descriptor, this);

public ICollection<string> ContentLanguage
{
get
{
if (_contentLanguage == null)
{
_contentLanguage = new HttpHeaderValueCollection<string>(KnownHeaders.ContentLanguage.Descriptor, this);
}
return _contentLanguage;
}
}
public ICollection<string> ContentLanguage =>
_contentLanguage ??= new HttpHeaderValueCollection<string>(KnownHeaders.ContentLanguage.Descriptor, this);

public long? ContentLength
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics;

namespace System.Net.Http.Headers
Expand Down Expand Up @@ -74,29 +73,11 @@ public DateTimeOffset? Date
set { _parent.SetOrRemoveParsedValue(KnownHeaders.Date.Descriptor, value); }
}

public HttpHeaderValueCollection<NameValueHeaderValue> Pragma
{
get
{
if (_pragma == null)
{
_pragma = new HttpHeaderValueCollection<NameValueHeaderValue>(KnownHeaders.Pragma.Descriptor, _parent);
}
return _pragma;
}
}
public HttpHeaderValueCollection<NameValueHeaderValue> Pragma =>
_pragma ??= new HttpHeaderValueCollection<NameValueHeaderValue>(KnownHeaders.Pragma.Descriptor, _parent);

public HttpHeaderValueCollection<string> Trailer
{
get
{
if (_trailer == null)
{
_trailer = new HttpHeaderValueCollection<string>(KnownHeaders.Trailer.Descriptor, _parent);
}
return _trailer;
}
}
public HttpHeaderValueCollection<string> Trailer =>
_trailer ??= new HttpHeaderValueCollection<string>(KnownHeaders.Trailer.Descriptor, _parent);

internal static bool? GetTransferEncodingChunked(HttpHeaders parent, HttpGeneralHeaders? headers)
{
Expand Down Expand Up @@ -139,65 +120,20 @@ public bool? TransferEncodingChunked
}
}

public HttpHeaderValueCollection<ProductHeaderValue> Upgrade
{
get
{
if (_upgrade == null)
{
_upgrade = new HttpHeaderValueCollection<ProductHeaderValue>(KnownHeaders.Upgrade.Descriptor, _parent);
}
return _upgrade;
}
}
public HttpHeaderValueCollection<ProductHeaderValue> Upgrade =>
_upgrade ??= new HttpHeaderValueCollection<ProductHeaderValue>(KnownHeaders.Upgrade.Descriptor, _parent);

public HttpHeaderValueCollection<ViaHeaderValue> Via
{
get
{
if (_via == null)
{
_via = new HttpHeaderValueCollection<ViaHeaderValue>(KnownHeaders.Via.Descriptor, _parent);
}
return _via;
}
}
public HttpHeaderValueCollection<ViaHeaderValue> Via =>
_via ??= new HttpHeaderValueCollection<ViaHeaderValue>(KnownHeaders.Via.Descriptor, _parent);

public HttpHeaderValueCollection<WarningHeaderValue> Warning
{
get
{
if (_warning == null)
{
_warning = new HttpHeaderValueCollection<WarningHeaderValue>(KnownHeaders.Warning.Descriptor, _parent);
}
return _warning;
}
}
public HttpHeaderValueCollection<WarningHeaderValue> Warning =>
_warning ??= new HttpHeaderValueCollection<WarningHeaderValue>(KnownHeaders.Warning.Descriptor, _parent);

public HttpHeaderValueCollection<string> Connection
{
get
{
if (_connection == null)
{
_connection = new HttpHeaderValueCollection<string>(KnownHeaders.Connection.Descriptor, _parent);
}
return _connection;
}
}
public HttpHeaderValueCollection<string> Connection =>
_connection ??= new HttpHeaderValueCollection<string>(KnownHeaders.Connection.Descriptor, _parent);

public HttpHeaderValueCollection<TransferCodingHeaderValue> TransferEncoding
{
get
{
if (_transferEncoding == null)
{
_transferEncoding = new HttpHeaderValueCollection<TransferCodingHeaderValue>(KnownHeaders.TransferEncoding.Descriptor, _parent);
}
return _transferEncoding;
}
}
public HttpHeaderValueCollection<TransferCodingHeaderValue> TransferEncoding =>
_transferEncoding ??= new HttpHeaderValueCollection<TransferCodingHeaderValue>(KnownHeaders.TransferEncoding.Descriptor, _parent);

internal HttpGeneralHeaders(HttpHeaders parent)
{
Expand Down