Skip to content

Commit 87ba7cd

Browse files
committed
fix: unmatched flag for RouteMethod enum
1 parent db768a5 commit 87ba7cd

File tree

3 files changed

+148
-34
lines changed

3 files changed

+148
-34
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,64 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
</PropertyGroup>
8-
9-
<ItemGroup>
10-
<ProjectReference Include="..\..\..\typed-components\src\TinyComponents.csproj" />
11-
<ProjectReference Include="..\Sisk.Documenting\Sisk.Documenting.csproj" />
12-
</ItemGroup>
13-
14-
</Project>
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
8+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
9+
10+
<EnableTrimAnalyzer>True</EnableTrimAnalyzer>
11+
<IsAotCompatible>true</IsAotCompatible>
12+
13+
<Title>Sisk.Documenting.Html</Title>
14+
<PackageId>Sisk.Documenting.Html</PackageId>
15+
16+
<Authors>CypherPotato</Authors>
17+
<Company>Project Principium</Company>
18+
<Product>Sisk.Documenting.Html</Product>
19+
<Description>This package provides the HtmlDocumentationExporter object.</Description>
20+
<PackageProjectUrl>https://sisk.proj.pw/</PackageProjectUrl>
21+
<PackageIcon>Icon.png</PackageIcon>
22+
<PackageReadmeFile>README.md</PackageReadmeFile>
23+
<RepositoryUrl>https://github.com/sisk-http/core</RepositoryUrl>
24+
<PackageTags>http-server,http,web framework</PackageTags>
25+
<RepositoryType>git</RepositoryType>
26+
27+
<AssemblyVersion>1.4.0</AssemblyVersion>
28+
<FileVersion>1.4.0</FileVersion>
29+
<Version>1.4.0-beta1</Version>
30+
31+
<NeutralLanguage>en</NeutralLanguage>
32+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
33+
<IncludeSymbols>True</IncludeSymbols>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
37+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
38+
39+
<!-- SYSLIB0020: IgnoreNullValues is obsolete -->
40+
<NoWarn>$(NoWarn);SYSLIB0020</NoWarn>
41+
</PropertyGroup>
42+
43+
<ItemGroup>
44+
<None Include="..\..\.github\Icon.png">
45+
<Pack>True</Pack>
46+
<PackagePath>\</PackagePath>
47+
</None>
48+
<None Include="..\..\.nuget\README.md">
49+
<Pack>True</Pack>
50+
<PackagePath>\</PackagePath>
51+
</None>
52+
<None Include="..\..\LICENSE.txt">
53+
<Pack>True</Pack>
54+
<PackagePath>\</PackagePath>
55+
</None>
56+
</ItemGroup>
57+
58+
<ItemGroup>
59+
<ProjectReference Include="..\..\..\typed-components\src\TinyComponents.csproj" />
60+
<ProjectReference Include="..\..\src\Sisk.Core.csproj" />
61+
<ProjectReference Include="..\Sisk.Documenting\Sisk.Documenting.csproj" />
62+
</ItemGroup>
63+
64+
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,63 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
8+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
89

9-
<ItemGroup>
10-
<ProjectReference Include="..\..\src\Sisk.Core.csproj" />
11-
</ItemGroup>
10+
<EnableTrimAnalyzer>True</EnableTrimAnalyzer>
11+
<IsAotCompatible>true</IsAotCompatible>
1212

13-
</Project>
13+
<Title>Sisk.Documenting</Title>
14+
<PackageId>Sisk.Documenting</PackageId>
15+
16+
<Authors>CypherPotato</Authors>
17+
<Company>Project Principium</Company>
18+
<Product>Sisk.Documenting</Product>
19+
<Description>This package provides a way to export documentation from your Sisk API.</Description>
20+
<PackageProjectUrl>https://sisk.proj.pw/</PackageProjectUrl>
21+
<PackageIcon>Icon.png</PackageIcon>
22+
<PackageReadmeFile>README.md</PackageReadmeFile>
23+
<RepositoryUrl>https://github.com/sisk-http/core</RepositoryUrl>
24+
<PackageTags>http-server,http,web framework</PackageTags>
25+
<RepositoryType>git</RepositoryType>
26+
27+
<AssemblyVersion>1.4.0</AssemblyVersion>
28+
<FileVersion>1.4.0</FileVersion>
29+
<Version>1.4.0-beta1</Version>
30+
31+
<NeutralLanguage>en</NeutralLanguage>
32+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
33+
<IncludeSymbols>True</IncludeSymbols>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
37+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
38+
39+
<!-- SYSLIB0020: IgnoreNullValues is obsolete -->
40+
<NoWarn>$(NoWarn);SYSLIB0020</NoWarn>
41+
</PropertyGroup>
42+
43+
<ItemGroup>
44+
<None Include="..\..\.github\Icon.png">
45+
<Pack>True</Pack>
46+
<PackagePath>\</PackagePath>
47+
</None>
48+
<None Include="..\..\.nuget\README.md">
49+
<Pack>True</Pack>
50+
<PackagePath>\</PackagePath>
51+
</None>
52+
<None Include="..\..\LICENSE.txt">
53+
<Pack>True</Pack>
54+
<PackagePath>\</PackagePath>
55+
</None>
56+
</ItemGroup>
57+
58+
<ItemGroup>
59+
<ProjectReference Include="..\..\..\..\LightJson\Sources\LightJson\LightJson.csproj" />
60+
<ProjectReference Include="..\..\src\Sisk.Core.csproj" />
61+
</ItemGroup>
62+
63+
</Project>

src/Routing/Router.Invoker.cs

+27-13
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,34 @@
1919
namespace Sisk.Core.Routing;
2020

2121
public partial class Router {
22-
private bool IsMethodMatching ( string ogRqMethod, RouteMethod method ) {
23-
switch (method) {
24-
case RouteMethod.Any:
25-
case RouteMethod.Get when ogRqMethod == "GET":
26-
case RouteMethod.Post when ogRqMethod == "POST":
27-
case RouteMethod.Put when ogRqMethod == "PUT":
28-
case RouteMethod.Patch when ogRqMethod == "PATCH":
29-
case RouteMethod.Options when ogRqMethod == "OPTIONS":
30-
case RouteMethod.Head when ogRqMethod == "HEAD":
31-
case RouteMethod.Delete when ogRqMethod == "DELETE":
32-
return true;
33-
}
3422

35-
return false;
23+
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
24+
private bool IsMethodMatching ( in string ogRqMethod, RouteMethod method ) {
25+
26+
if (ogRqMethod.Equals ( "GET", StringComparison.Ordinal )) {
27+
return method.HasFlag ( RouteMethod.Get );
28+
}
29+
else if (ogRqMethod.Equals ( "POST", StringComparison.Ordinal )) {
30+
return method.HasFlag ( RouteMethod.Post );
31+
}
32+
else if (ogRqMethod.Equals ( "PUT", StringComparison.Ordinal )) {
33+
return method.HasFlag ( RouteMethod.Put );
34+
}
35+
else if (ogRqMethod.Equals ( "PATCH", StringComparison.Ordinal )) {
36+
return method.HasFlag ( RouteMethod.Patch );
37+
}
38+
else if (ogRqMethod.Equals ( "OPTIONS", StringComparison.Ordinal )) {
39+
return method.HasFlag ( RouteMethod.Options );
40+
}
41+
else if (ogRqMethod.Equals ( "HEAD", StringComparison.Ordinal )) {
42+
return method.HasFlag ( RouteMethod.Head );
43+
}
44+
else if (ogRqMethod.Equals ( "DELETE", StringComparison.Ordinal )) {
45+
return method.HasFlag ( RouteMethod.Delete );
46+
}
47+
else {
48+
return method.HasFlag ( RouteMethod.Any );
49+
}
3650
}
3751

3852
private RouteMatch TestRouteMatchUsingRegex ( Route route, string requestPath ) {

0 commit comments

Comments
 (0)