Skip to content

Improve documentation RequestHeaders and ResponseHeaders #14971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2019
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
16 changes: 16 additions & 0 deletions src/Http/Http.Extensions/src/RequestHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,27 @@ public Uri Referer
}
}

/// <summary>
/// Gets the value of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParse method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>The value of the header.</returns>
public T Get<T>(string name)
{
return Headers.Get<T>(name);
}

/// <summary>
/// Gets the values of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParseList method with the signature <code>public static bool TryParseList(IList&lt;string&gt;, out IList&lt;T&gt;)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParseList method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>List of values of the header.</returns>
public IList<T> GetList<T>(string name)
{
return Headers.GetList<T>(name);
Expand Down
18 changes: 17 additions & 1 deletion src/Http/Http.Extensions/src/ResponseHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,27 @@ public IList<SetCookieHeaderValue> SetCookie
}
}

/// <summary>
/// Gets the value of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParse method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>The value of the header.</returns>
public T Get<T>(string name)
{
return Headers.Get<T>(name);
}

/// <summary>
/// Gets the values of header with <paramref name="name"/>.
/// </summary>
/// <remarks><typeparamref name="T"/> must contain a TryParseList method with the signature <code>public static bool TryParseList(IList&lt;string&gt;, out IList&lt;T&gt;)</code>.</remarks>
/// <typeparam name="T">The type of the header.
/// The given type must have a static TryParseList method.</typeparam>
/// <param name="name">The name of the header to retrieve.</param>
/// <returns>List of values of the header.</returns>
public IList<T> GetList<T>(string name)
{
return Headers.GetList<T>(name);
Expand Down Expand Up @@ -208,4 +224,4 @@ public void AppendList<T>(string name, IList<T> values)
Headers.AppendList<T>(name, values);
}
}
}
}