mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 15:23:47 +01:00
* Update BodyParser logic * update logic for byte[] * small update * MyGetKey * myget * dotnet nuget push * dotnet build * Release * . * StringContent * 1.0.4.18-preview-02 * Debug * 1.0.4.18-preview-02 * disable some proxy tests * myget * packagesToPack * fix * <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> * Release * <VersionPrefix>1.0.4.18</VersionPrefix> * fix * BodyParserTests * ResponseBodyData (#216) * ResponseBodyData * refactor tests * LogEntryMapperTests
64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WireMock.Util;
|
|
using WireMock.Validation;
|
|
|
|
namespace WireMock
|
|
{
|
|
/// <summary>
|
|
/// The ResponseMessage.
|
|
/// </summary>
|
|
public class ResponseMessage
|
|
{
|
|
/// <summary>
|
|
/// Gets the headers.
|
|
/// </summary>
|
|
public IDictionary<string, WireMockList<string>> Headers { get; set; } = new Dictionary<string, WireMockList<string>>();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the status code.
|
|
/// </summary>
|
|
public int StatusCode { get; set; } = 200;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the body.
|
|
/// </summary>
|
|
public string BodyOriginal { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the body destination (SameAsSource, String or Bytes).
|
|
/// </summary>
|
|
public string BodyDestination { get; set; }
|
|
|
|
/// <summary>
|
|
/// The Body.
|
|
/// </summary>
|
|
public BodyData BodyData { get; set; }
|
|
|
|
/// <summary>
|
|
/// Adds the header.
|
|
/// </summary>
|
|
/// <param name="name">The name.</param>
|
|
/// <param name="value">The value.</param>
|
|
public void AddHeader(string name, string value)
|
|
{
|
|
Headers.Add(name, new WireMockList<string>(value));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds the header.
|
|
/// </summary>
|
|
/// <param name="name">The name.</param>
|
|
/// <param name="values">The values.</param>
|
|
public void AddHeader(string name, params string[] values)
|
|
{
|
|
Check.NotNullOrEmpty(values, nameof(values));
|
|
|
|
var newHeaderValues = Headers.TryGetValue(name, out WireMockList<string> existingValues)
|
|
? values.Union(existingValues).ToArray()
|
|
: values;
|
|
|
|
Headers[name] = new WireMockList<string>(newHeaderValues);
|
|
}
|
|
}
|
|
} |