Skip to content

Commit fc4d087

Browse files
voroninpJamesNK
andauthored
Mention Metadata.BinaryHeaderSuffix in xmldoc comments of Metadata.En… (#2027)
Co-authored-by: James Newton-King <[email protected]>
1 parent 674758e commit fc4d087

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Grpc.Core.Api/Metadata.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,20 @@ public IEnumerable<Entry> GetAll(string key)
128128
}
129129

130130
/// <summary>
131-
/// Adds a new ASCII-valued metadata entry. See <c>Metadata.Entry</c> constructor for params.
131+
/// Adds a new ASCII-valued metadata entry.
132132
/// </summary>
133+
/// <param name="key">Metadata key. Gets converted to lowercase. Must not use <c>-bin</c> suffix indicating a binary-valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots.</param>
134+
/// <param name="value">Value string. Only ASCII characters are allowed.</param>
133135
public void Add(string key, string value)
134136
{
135137
Add(new Entry(key, value));
136138
}
137139

138140
/// <summary>
139-
/// Adds a new binary-valued metadata entry. See <c>Metadata.Entry</c> constructor for params.
141+
/// Adds a new binary-valued metadata entry.
140142
/// </summary>
143+
/// <param name="key">Metadata key. Gets converted to lowercase. Needs to have <c>-bin</c> suffix indicating a binary-valued metadata entry. The binary header suffix can be added to the key with <see cref="Metadata.BinaryHeaderSuffix"/>. Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots.</param>
144+
/// <param name="valueBytes">Value bytes.</param>
141145
public void Add(string key, byte[] valueBytes)
142146
{
143147
Add(new Entry(key, valueBytes));
@@ -290,13 +294,13 @@ private Entry(string key, string? value, byte[]? valueBytes)
290294
/// <summary>
291295
/// Initializes a new instance of the <see cref="Grpc.Core.Metadata.Entry"/> struct with a binary value.
292296
/// </summary>
293-
/// <param name="key">Metadata key. Gets converted to lowercase. Needs to have suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots.</param>
297+
/// <param name="key">Metadata key. Gets converted to lowercase. Needs to have <c>-bin</c> suffix indicating a binary-valued metadata entry. The binary header suffix can be added to the key with <see cref="Metadata.BinaryHeaderSuffix"/>. Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots.</param>
294298
/// <param name="valueBytes">Value bytes.</param>
295299
public Entry(string key, byte[] valueBytes)
296300
{
297301
this.key = NormalizeKey(key);
298302
GrpcPreconditions.CheckArgument(HasBinaryHeaderSuffix(this.key),
299-
"Key for binary valued metadata entry needs to have suffix indicating binary value.");
303+
$"Key for binary valued metadata entry needs to have '{BinaryHeaderSuffix}' suffix indicating binary value.");
300304
this.value = null;
301305
GrpcPreconditions.CheckNotNull(valueBytes, "valueBytes");
302306
this.valueBytes = new byte[valueBytes.Length];
@@ -306,7 +310,7 @@ public Entry(string key, byte[] valueBytes)
306310
/// <summary>
307311
/// Initializes a new instance of the <see cref="Grpc.Core.Metadata.Entry"/> struct with an ASCII value.
308312
/// </summary>
309-
/// <param name="key">Metadata key. Gets converted to lowercase. Must not use suffix indicating a binary valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens and dots.</param>
313+
/// <param name="key">Metadata key. Gets converted to lowercase. Must not use '-bin' suffix indicating a binary-valued metadata entry. Can only contain lowercase alphanumeric characters, underscores, hyphens, and dots.</param>
310314
/// <param name="value">Value string. Only ASCII characters are allowed.</param>
311315
public Entry(string key, string value)
312316
{

0 commit comments

Comments
 (0)