Fix google protobuf WellKnownTypes: Empty, Duration and Timestamp (#1231)

* Fix google protobuf WellKnownTypes: Timestamp and Duration

* Fix protobuf Empty

* .

* small refactor

* 006

* fix

* policy

* ---

* <PackageReference Include="ProtoBufJsonConverter" Version="0.7.0" />
This commit is contained in:
Stef Heyenrath
2025-01-09 18:50:16 +01:00
committed by GitHub
parent 9c94324cff
commit 44c1c7aaa8
15 changed files with 413 additions and 79 deletions

View File

@@ -242,7 +242,7 @@ public partial class Response
Guard.NotNull(value);
#if !PROTOBUF
throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
throw new NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
#else
ResponseMessage.BodyDestination = null;
ResponseMessage.BodyData = new BodyData
@@ -252,8 +252,9 @@ public partial class Response
ProtoDefinition = () => new IdOrTexts(null, protoDefinitions),
ProtoBufMessageType = messageType
};
#endif
return this;
#endif
}
/// <inheritdoc />
@@ -268,7 +269,7 @@ public partial class Response
Guard.NotNull(value);
#if !PROTOBUF
throw new System.NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
throw new NotSupportedException("The WithBodyAsProtoBuf method can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
#else
ResponseMessage.BodyDestination = null;
ResponseMessage.BodyData = new BodyData
@@ -278,7 +279,8 @@ public partial class Response
ProtoDefinition = () => Mapping.ProtoDefinition ?? throw new WireMockException("ProtoDefinition cannot be resolved. You probably forgot to call .WithProtoDefinition(...) on the mapping."),
ProtoBufMessageType = messageType
};
#endif
return this;
#endif
}
}