mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-27 10:47:01 +02:00
Add implicit operators to WireMockList (#823)
* Add implicit operators to WireMockList * .
This commit is contained in:
@@ -39,7 +39,7 @@ public class ResponseMessage : IResponseMessage
|
||||
public void AddHeader(string name, string value)
|
||||
{
|
||||
Headers ??= new Dictionary<string, WireMockList<string>>();
|
||||
Headers.Add(name, new WireMockList<string>(value));
|
||||
Headers.Add(name, value);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IResponseMessage.AddHeader(string, string[])" />
|
||||
@@ -52,6 +52,6 @@ public class ResponseMessage : IResponseMessage
|
||||
? values.Union(existingValues).ToArray()
|
||||
: values;
|
||||
|
||||
Headers[name] = new WireMockList<string>(newHeaderValues);
|
||||
Headers[name] = newHeaderValues;
|
||||
}
|
||||
}
|
||||
@@ -251,8 +251,15 @@ internal class MappingConverter
|
||||
var newDictionary = new Dictionary<string, object>();
|
||||
foreach (var entry in dictionary)
|
||||
{
|
||||
object value = entry.Value.Count == 1 ? entry.Value.ToString() : entry.Value;
|
||||
newDictionary.Add(entry.Key, value);
|
||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||
if (entry.Value.Count == 1)
|
||||
{
|
||||
newDictionary.Add(entry.Key, entry.Value.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
newDictionary.Add(entry.Key, entry.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return newDictionary;
|
||||
|
||||
Reference in New Issue
Block a user