diff --git a/src/Spacetime.Core/SpacetimeRestService.cs b/src/Spacetime.Core/SpacetimeRestService.cs index 774c71c..ff4453c 100644 --- a/src/Spacetime.Core/SpacetimeRestService.cs +++ b/src/Spacetime.Core/SpacetimeRestService.cs @@ -13,11 +13,6 @@ public class SpacetimeRestService : ISpacetimeService private readonly HttpClient _client; private readonly UrlBuilder _urlBuilder; private readonly ResponseOptions _defaultResponseOptions = new (); - private readonly Dictionary _methods = new () - { - {"GET", HttpMethod.Get }, - {"POST", HttpMethod.Post } - }; private readonly IFormatterFactory _formatter; @@ -97,7 +92,7 @@ private HttpRequestMessage BuildHttpRequest(SpacetimeRequest request) // will fail if we add more methods without updating map // maybe just switch to storing HttpMethod or another enum later - Method = _methods[request.Method], + Method = SupportedHttpMethods.AllMethods[request.Method] }; if (!string.IsNullOrWhiteSpace(request.RequestBody)) diff --git a/src/Spacetime.Core/SupportedHttpMethods.cs b/src/Spacetime.Core/SupportedHttpMethods.cs new file mode 100644 index 0000000..cc8d4ff --- /dev/null +++ b/src/Spacetime.Core/SupportedHttpMethods.cs @@ -0,0 +1,15 @@ +namespace Spacetime.Core; + +public static class SupportedHttpMethods +{ + public static readonly Dictionary AllMethods = new () + { + {"GET", HttpMethod.Get }, + {"POST", HttpMethod.Post }, + {"PUT", HttpMethod.Put }, + {"PATCH", HttpMethod.Patch }, + {"DELETE", HttpMethod.Delete }, + {"HEAD", HttpMethod.Head }, + {"OPTIONS", HttpMethod.Options } + }; +} \ No newline at end of file diff --git a/src/Spacetime/Shared/Components/Rest/RestView.razor b/src/Spacetime/Shared/Components/Rest/RestView.razor index 691412d..4f51166 100644 --- a/src/Spacetime/Shared/Components/Rest/RestView.razor +++ b/src/Spacetime/Shared/Components/Rest/RestView.razor @@ -32,8 +32,10 @@ Icon="@(DrawerOpen ? Icons.Filled.ChevronLeft : Icons.Filled.ChevronRight)" OnClick="OnDrawerToggle"/> - - + @foreach (var httpMethodName in SupportedHttpMethods.AllMethods.Keys) + { + + }