Additional fixes for 3.0

This commit is contained in:
nicolas.dorier
2019-10-09 17:06:00 +09:00
parent c5ba063edf
commit 8643c04a39
7 changed files with 11 additions and 6 deletions

View File

@@ -26,11 +26,10 @@ namespace BTCPayServer.Tests
_Host = new WebHostBuilder() _Host = new WebHostBuilder()
.Configure(app => .Configure(app =>
{ {
app.Run(req => app.Run(async req =>
{ {
_Requests.Writer.WriteAsync(JsonConvert.DeserializeObject<JObject>(new StreamReader(req.Request.Body).ReadToEnd()), _Closed.Token); await _Requests.Writer.WriteAsync(JsonConvert.DeserializeObject<JObject>(await new StreamReader(req.Request.Body).ReadToEndAsync()), _Closed.Token);
req.Response.StatusCode = 200; req.Response.StatusCode = 200;
return Task.CompletedTask;
}); });
}) })
.UseKestrel() .UseKestrel()

View File

@@ -182,7 +182,7 @@ namespace BTCPayServer.Tests
public async Task<BTCPayOpenIdClient> RegisterOpenIdClient(OpenIddictApplicationDescriptor descriptor, string secret = null) public async Task<BTCPayOpenIdClient> RegisterOpenIdClient(OpenIddictApplicationDescriptor descriptor, string secret = null)
{ {
var openIddictApplicationManager = parent.PayTester.GetService<OpenIddictApplicationManager<BTCPayOpenIdClient>>(); var openIddictApplicationManager = parent.PayTester.GetService<OpenIddictApplicationManager<BTCPayOpenIdClient>>();
var client = new BTCPayOpenIdClient {ApplicationUserId = UserId}; var client = new BTCPayOpenIdClient { Id = Guid.NewGuid().ToString(), ApplicationUserId = UserId};
await openIddictApplicationManager.PopulateAsync(client, descriptor); await openIddictApplicationManager.PopulateAsync(client, descriptor);
await openIddictApplicationManager.CreateAsync(client, secret); await openIddictApplicationManager.CreateAsync(client, secret);
return client; return client;

View File

@@ -2993,6 +2993,7 @@ noninventoryitem:
{ {
var newDevice = new U2FDevice() var newDevice = new U2FDevice()
{ {
Id = Guid.NewGuid().ToString(),
Name = "fake", Name = "fake",
Counter = 0, Counter = 0,
KeyHandle = UTF8Encoding.UTF8.GetBytes("fake"), KeyHandle = UTF8Encoding.UTF8.GetBytes("fake"),

View File

@@ -47,7 +47,11 @@ namespace BTCPayServer.Models
} }
context.HttpContext.Response.Headers.Add("Content-Type", new Microsoft.Extensions.Primitives.StringValues("application/json")); context.HttpContext.Response.Headers.Add("Content-Type", new Microsoft.Extensions.Primitives.StringValues("application/json"));
var str = JsonConvert.SerializeObject(jobj); var str = JsonConvert.SerializeObject(jobj);
#if NETCOREAPP21
using (var writer = new StreamWriter(context.HttpContext.Response.Body, new UTF8Encoding(false), 1024 * 10, true)) using (var writer = new StreamWriter(context.HttpContext.Response.Body, new UTF8Encoding(false), 1024 * 10, true))
#else
await using (var writer = new StreamWriter(context.HttpContext.Response.Body, new UTF8Encoding(false), 1024 * 10, true))
#endif
{ {
await writer.WriteAsync(str); await writer.WriteAsync(str);
} }

View File

@@ -555,7 +555,7 @@ retry:
if (queryObject.ExceptionStatus != null && queryObject.ExceptionStatus.Length > 0) if (queryObject.ExceptionStatus != null && queryObject.ExceptionStatus.Length > 0)
{ {
var exceptionStatusSet = queryObject.ExceptionStatus.Select(s => NormalizeExceptionStatus(s)).ToHashSet(); var exceptionStatusSet = queryObject.ExceptionStatus.Select(s => NormalizeExceptionStatus(s)).ToHashSet().ToArray();
query = query.Where(i => exceptionStatusSet.Contains(i.ExceptionStatus)); query = query.Where(i => exceptionStatusSet.Contains(i.ExceptionStatus));
} }

View File

@@ -31,6 +31,7 @@ namespace BTCPayServer.Services.PaymentRequests
{ {
if (string.IsNullOrEmpty(entity.Id)) if (string.IsNullOrEmpty(entity.Id))
{ {
entity.Id = Guid.NewGuid().ToString();
await context.PaymentRequests.AddAsync(entity); await context.PaymentRequests.AddAsync(entity);
} }
else else

View File

@@ -3,7 +3,7 @@
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFramework> <TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFramework>
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn> <NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
<LangVersion>7.3</LangVersion> <LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'"> <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>$(DefineConstants);NETCOREAPP21</DefineConstants> <DefineConstants>$(DefineConstants);NETCOREAPP21</DefineConstants>