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
73 lines
4.0 KiB
C#
73 lines
4.0 KiB
C#
using System;
|
|
using System.Text;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace WireMock.ResponseBuilders
|
|
{
|
|
/// <summary>
|
|
/// The BodyResponseBuilder interface.
|
|
/// </summary>
|
|
public interface IBodyResponseBuilder : ITransformResponseBuilder
|
|
{
|
|
/// <summary>
|
|
/// WithBody : Create a ... response based on a string.
|
|
/// </summary>
|
|
/// <param name="body">The body.</param>
|
|
/// <param name="destination">The Body Destination format (SameAsSource, String or Bytes).</param>
|
|
/// <param name="encoding">The body encoding.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBody([NotNull] string body, [CanBeNull] string destination = BodyDestinationFormat.SameAsSource, [CanBeNull] Encoding encoding = null);
|
|
|
|
/// <summary>
|
|
/// WithBody : Create a ... response based on a callback function.
|
|
/// </summary>
|
|
/// <param name="bodyFactory">The delegate to build the body.</param>
|
|
/// <param name="destination">The Body Destination format (SameAsSource, String or Bytes).</param>
|
|
/// <param name="encoding">The body encoding.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBody([NotNull] Func<RequestMessage, string> bodyFactory, [CanBeNull] string destination = BodyDestinationFormat.SameAsSource, [CanBeNull] Encoding encoding = null);
|
|
|
|
/// <summary>
|
|
/// WithBody : Create a ... response based on a bytearray.
|
|
/// </summary>
|
|
/// <param name="body">The body.</param>
|
|
/// <param name="destination">The Body Destination format (SameAsSource, String or Bytes).</param>
|
|
/// <param name="encoding">The body encoding.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBody([NotNull] byte[] body, [CanBeNull] string destination = BodyDestinationFormat.SameAsSource, [CanBeNull] Encoding encoding = null);
|
|
|
|
/// <summary>
|
|
/// WithBody : Create a string response based on a object (which will be converted to a JSON string).
|
|
/// </summary>
|
|
/// <param name="body">The body.</param>
|
|
/// <param name="encoding">The body encoding.</param>
|
|
/// <param name="indented">Use JSON indented.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBodyAsJson([NotNull] object body, [CanBeNull] Encoding encoding = null, bool? indented = null);
|
|
|
|
/// <summary>
|
|
/// WithBody : Create a string response based on a object (which will be converted to a JSON string).
|
|
/// </summary>
|
|
/// <param name="body">The body.</param>
|
|
/// <param name="indented">Define whether child objects to be indented according to the Newtonsoft.Json.JsonTextWriter.Indentation and Newtonsoft.Json.JsonTextWriter.IndentChar settings.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBodyAsJson([NotNull] object body, bool indented);
|
|
|
|
/// <summary>
|
|
/// WithBody : Create a string response based on a Base64 string (which will be decoded to a normal string).
|
|
/// </summary>
|
|
/// <param name="bodyAsBase64">The body.</param>
|
|
/// <param name="encoding">The Encoding.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
[Obsolete("Should not be used, will be removed in future.")]
|
|
IResponseBuilder WithBodyFromBase64([NotNull] string bodyAsBase64, [CanBeNull] Encoding encoding = null);
|
|
|
|
/// <summary>
|
|
/// WithBodyFromFile : Create a ... response based on a File.
|
|
/// </summary>
|
|
/// <param name="filename">The filename.</param>
|
|
/// <param name="cache">Defines if this file is cached in memory or retrieved from disk every time the response is created.</param>
|
|
/// <returns>A <see cref="IResponseBuilder"/>.</returns>
|
|
IResponseBuilder WithBodyFromFile([NotNull] string filename, bool cache = true);
|
|
}
|
|
} |