Better data (BioRad)

EC / IFX
FromBody bug fix
Made ID optional and are get all files now
This commit is contained in:
2023-03-08 12:47:22 -07:00
parent de048b6842
commit 8040a7c6b5
6 changed files with 248 additions and 87 deletions

View File

@ -30,18 +30,23 @@ public partial class InboundController : ControllerBase, IInboundController<IAct
_MetrologyRepository = metrologyRepository;
}
private static JToken GetJToken(Stream stream)
private static string? GetJson(Stream stream)
{
JToken jsonbody;
string? result;
if (!stream.CanRead)
jsonbody = JToken.Parse("{}");
result = null;
else
{
if (stream.CanSeek)
_ = stream.Seek(0, SeekOrigin.Begin);
string json = new StreamReader(stream).ReadToEnd();
jsonbody = JToken.Parse(json);
Task<string> task = new StreamReader(stream).ReadToEndAsync();
result = task.Result;
}
return result;
}
private static JToken GetJToken(Stream stream)
{
string? json = GetJson(stream);
JToken jsonbody = string.IsNullOrEmpty(json) ? JToken.Parse("{}") : JToken.Parse(json);
return jsonbody;
}