using System.Collections.Generic; using System.Linq; using Stef.Validation; using WireMock.Types; namespace WireMock.ResponseBuilders; public partial class Response { /// public IResponseBuilder WithHeader(string name, params string[] values) { Guard.NotNull(name); ResponseMessage.AddHeader(name, values); return this; } /// public IResponseBuilder WithHeaders(IDictionary headers) { Guard.NotNull(headers); ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList(header.Value)); return this; } /// public IResponseBuilder WithHeaders(IDictionary headers) { Guard.NotNull(headers); ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList(header.Value)); return this; } /// public IResponseBuilder WithHeaders(IDictionary> headers) { Guard.NotNull(headers); ResponseMessage.Headers = headers; return this; } /// public IResponseBuilder WithTrailingHeader(string name, params string[] values) { #if !TRAILINGHEADERS throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower."); #else Guard.NotNull(name); ResponseMessage.AddTrailingHeader(name, values); return this; #endif } /// public IResponseBuilder WithTrailingHeaders(IDictionary headers) { #if !TRAILINGHEADERS throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower."); #else Guard.NotNull(headers); ResponseMessage.TrailingHeaders = headers.ToDictionary(header => header.Key, header => new WireMockList(header.Value)); return this; #endif } /// public IResponseBuilder WithTrailingHeaders(IDictionary headers) { #if !TRAILINGHEADERS throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower."); #else Guard.NotNull(headers); ResponseMessage.TrailingHeaders = headers.ToDictionary(header => header.Key, header => new WireMockList(header.Value)); return this; #endif } /// public IResponseBuilder WithTrailingHeaders(IDictionary> headers) { #if !TRAILINGHEADERS throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower."); #else Guard.NotNull(headers); ResponseMessage.TrailingHeaders = headers; return this; #endif } }