mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-19 06:59:43 +02:00
Add Grpc ProtoBuf support (request-response) (#1047)
* ProtoBuf
* .
* x
* ---
* x
* fx
* ...
* sc
* ...
* .
* groen
* x
* fix tests
* ok!?
* fix tests
* fix tests
* !
* x
* 6
* .
* x
* ivaluematcher
* transformer
* .
* sc
* .
* mapping
* x
* tra
* com
* ...
* .
* .
* .
* AddProtoDefinition
* .
* set
* grpahj
* .
* .
* IdOrText
* ...
* async
* async2
* .
* t
* nuget
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0-preview-04" />
* http version
* tests
* .WithHttpVersion("2")
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0" />
* HttpVersionParser
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WireMock.Models;
|
||||
using WireMock.Types;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WireMock.Util;
|
||||
|
||||
/// <summary>
|
||||
@@ -10,7 +13,7 @@ namespace WireMock.Util;
|
||||
public interface IBodyData
|
||||
{
|
||||
/// <summary>
|
||||
/// The body (as bytearray).
|
||||
/// The body (as byte array).
|
||||
/// </summary>
|
||||
byte[]? BodyAsBytes { get; set; }
|
||||
|
||||
@@ -26,6 +29,7 @@ public interface IBodyData
|
||||
|
||||
/// <summary>
|
||||
/// The body (as JSON object).
|
||||
/// Also used for ProtoBuf.
|
||||
/// </summary>
|
||||
object? BodyAsJson { get; set; }
|
||||
|
||||
@@ -68,4 +72,16 @@ public interface IBodyData
|
||||
/// Defines if this BodyData is the result of a dynamically created response-string. (
|
||||
/// </summary>
|
||||
public string? IsFuncUsed { get; set; }
|
||||
|
||||
#region ProtoBuf
|
||||
/// <summary>
|
||||
/// Gets or sets the proto definition.
|
||||
/// </summary>
|
||||
public Func<IdOrText>? ProtoDefinition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the full type of the protobuf (request/response) message object. Format is "{package-name}.{type-name}".
|
||||
/// </summary>
|
||||
public string? ProtoBufMessageType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
33
src/WireMock.Net.Abstractions/Models/IdOrText.cs
Normal file
33
src/WireMock.Net.Abstractions/Models/IdOrText.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace WireMock.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A structure defining an (optional) Id and a Text.
|
||||
/// </summary>
|
||||
public readonly struct IdOrText
|
||||
{
|
||||
/// <summary>
|
||||
/// The Id [optional].
|
||||
/// </summary>
|
||||
public string? Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Text.
|
||||
/// </summary>
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// When Id is defined, return the Id, else the Text.
|
||||
/// </summary>
|
||||
public string Value => Id ?? Text;
|
||||
|
||||
/// <summary>
|
||||
/// Create a IdOrText
|
||||
/// </summary>
|
||||
/// <param name="id">The Id [optional]</param>
|
||||
/// <param name="text">The Text.</param>
|
||||
public IdOrText(string? id, string text)
|
||||
{
|
||||
Id = id;
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user