using System.Collections.Generic; using System.Linq; using WireMock.Util; using WireMock.Validation; namespace WireMock { /// /// The ResponseMessage. /// public class ResponseMessage { /// /// Gets the headers. /// public IDictionary> Headers { get; set; } = new Dictionary>(); /// /// Gets or sets the status code. /// public int StatusCode { get; set; } = 200; /// /// Gets or sets the body. /// public string BodyOriginal { get; set; } /// /// Gets or sets the body destination (SameAsSource, String or Bytes). /// public string BodyDestination { get; set; } /// /// The Body. /// public BodyData BodyData { get; set; } /// /// Adds the header. /// /// The name. /// The value. public void AddHeader(string name, string value) { Headers.Add(name, new WireMockList(value)); } /// /// Adds the header. /// /// The name. /// The values. public void AddHeader(string name, params string[] values) { Check.NotNullOrEmpty(values, nameof(values)); var newHeaderValues = Headers.TryGetValue(name, out WireMockList existingValues) ? values.Union(existingValues).ToArray() : values; Headers[name] = new WireMockList(newHeaderValues); } } }