mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-26 10:18:26 +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:
101
src/WireMock.Net/ResponseBuilders/Response.WithHeaders.cs
Normal file
101
src/WireMock.Net/ResponseBuilders/Response.WithHeaders.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Stef.Validation;
|
||||
using WireMock.Types;
|
||||
|
||||
namespace WireMock.ResponseBuilders;
|
||||
|
||||
public partial class Response
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithHeader(string name, params string[] values)
|
||||
{
|
||||
Guard.NotNull(name);
|
||||
|
||||
ResponseMessage.AddHeader(name, values);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithHeaders(IDictionary<string, string> headers)
|
||||
{
|
||||
Guard.NotNull(headers);
|
||||
|
||||
ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList<string>(header.Value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithHeaders(IDictionary<string, string[]> headers)
|
||||
{
|
||||
Guard.NotNull(headers);
|
||||
|
||||
ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList<string>(header.Value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithHeaders(IDictionary<string, WireMockList<string>> headers)
|
||||
{
|
||||
Guard.NotNull(headers);
|
||||
|
||||
ResponseMessage.Headers = headers;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithTrailingHeaders(IDictionary<string, string> 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<string>(header.Value));
|
||||
return this;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithTrailingHeaders(IDictionary<string, string[]> 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<string>(header.Value));
|
||||
return this;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IResponseBuilder WithTrailingHeaders(IDictionary<string, WireMockList<string>> 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user