Skip to content

Commit 1599a5a

Browse files
koenekelschotTratcher
authored andcommitted
Improve documentation RequestHeaders and ResponseHeaders #3465 (#14971)
1 parent d73dfd3 commit 1599a5a

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/Http/Http.Extensions/src/RequestHeaders.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,27 @@ public Uri Referer
279279
}
280280
}
281281

282+
/// <summary>
283+
/// Gets the value of header with <paramref name="name"/>.
284+
/// </summary>
285+
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
286+
/// <typeparam name="T">The type of the header.
287+
/// The given type must have a static TryParse method.</typeparam>
288+
/// <param name="name">The name of the header to retrieve.</param>
289+
/// <returns>The value of the header.</returns>
282290
public T Get<T>(string name)
283291
{
284292
return Headers.Get<T>(name);
285293
}
286294

295+
/// <summary>
296+
/// Gets the values of header with <paramref name="name"/>.
297+
/// </summary>
298+
/// <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>
299+
/// <typeparam name="T">The type of the header.
300+
/// The given type must have a static TryParseList method.</typeparam>
301+
/// <param name="name">The name of the header to retrieve.</param>
302+
/// <returns>List of values of the header.</returns>
287303
public IList<T> GetList<T>(string name)
288304
{
289305
return Headers.GetList<T>(name);

src/Http/Http.Extensions/src/ResponseHeaders.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,27 @@ public IList<SetCookieHeaderValue> SetCookie
158158
}
159159
}
160160

161+
/// <summary>
162+
/// Gets the value of header with <paramref name="name"/>.
163+
/// </summary>
164+
/// <remarks><typeparamref name="T"/> must contain a TryParse method with the signature <code>public static bool TryParse(string, out T)</code>.</remarks>
165+
/// <typeparam name="T">The type of the header.
166+
/// The given type must have a static TryParse method.</typeparam>
167+
/// <param name="name">The name of the header to retrieve.</param>
168+
/// <returns>The value of the header.</returns>
161169
public T Get<T>(string name)
162170
{
163171
return Headers.Get<T>(name);
164172
}
165173

174+
/// <summary>
175+
/// Gets the values of header with <paramref name="name"/>.
176+
/// </summary>
177+
/// <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>
178+
/// <typeparam name="T">The type of the header.
179+
/// The given type must have a static TryParseList method.</typeparam>
180+
/// <param name="name">The name of the header to retrieve.</param>
181+
/// <returns>List of values of the header.</returns>
166182
public IList<T> GetList<T>(string name)
167183
{
168184
return Headers.GetList<T>(name);
@@ -208,4 +224,4 @@ public void AppendList<T>(string name, IList<T> values)
208224
Headers.AppendList<T>(name, values);
209225
}
210226
}
211-
}
227+
}

0 commit comments

Comments
 (0)