mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
fix protobuf
This commit is contained in:
parent
5ea1af44d3
commit
a6c01f4658
3 changed files with 22 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Google.Protobuf;
|
||||
|
@ -8,8 +9,24 @@ namespace BTCPayServer.App.API;
|
|||
|
||||
public class ProtobufInputFormatter : InputFormatter
|
||||
{
|
||||
public ProtobufInputFormatter()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
}
|
||||
|
||||
public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool CanRead(InputFormatterContext context)
|
||||
{
|
||||
return base.CanRead(context);
|
||||
}
|
||||
|
||||
public override async Task<InputFormatterResult> ReadAsync(InputFormatterContext context)
|
||||
{
|
||||
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
|
|
|
@ -9,6 +9,10 @@ namespace BTCPayServer.App.API;
|
|||
|
||||
public class ProtobufOutputFormatter : OutputFormatter
|
||||
{
|
||||
public ProtobufOutputFormatter()
|
||||
{
|
||||
SupportedMediaTypes.Add("application/octet-stream");
|
||||
}
|
||||
public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
|
||||
{
|
||||
if (context == null)
|
||||
|
@ -40,4 +44,4 @@ public class ProtobufOutputFormatter : OutputFormatter
|
|||
await stream.CopyToAsync(response.Body);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NBitcoin.Crypto;
|
||||
using VSSProto;
|
||||
|
||||
namespace BTCPayServer.App.API;
|
||||
|
|
Loading…
Add table
Reference in a new issue