fix: minor Web API enhancements

* changed path for DevJson to include the device key instead of requiring it in the body
* Made the `GetRequestBody` method an extension method for the `HttpCwsRequest` class
This commit is contained in:
Andrew Welker
2024-05-24 16:12:50 -05:00
parent 5afdc2effa
commit effefc939c
7 changed files with 41 additions and 15 deletions

View File

@@ -7,11 +7,11 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core.Web
{
public class EssentialsWebApiHelpers
public static class EssentialsWebApiHelpers
{
public static string GetRequestBody(HttpCwsRequest request)
public static string GetRequestBody(this HttpCwsRequest request)
{
var bytes = new Byte[request.ContentLength];
var bytes = new byte[request.ContentLength];
request.InputStream.Read(bytes, 0, request.ContentLength);
@@ -22,8 +22,8 @@ namespace PepperDash.Essentials.Core.Web
{
return new
{
Name = assembly.Name,
Version = assembly.Version
assembly.Name,
assembly.Version
};
}
@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Core.Web
{
return new
{
Key = device.Key,
device.Key,
Name = (device is IKeyName)
? (device as IKeyName).Name
: "---"