Skip to content

Commit 19b136f

Browse files
authored
ASP.NET Core flip Json and plaintext (#5672)
1 parent 7555405 commit 19b136f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,28 @@ public static class Paths
6060
#endif
6161
public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded)
6262
{
63-
var requestType = RequestType.NotRecognized;
63+
#if !DATABASE
6464
if (method == HttpMethod.Get)
6565
{
66-
#if !DATABASE
6766
if (path.Length >= 2 && path[0] == '/')
6867
{
69-
if (path[1] == 'j')
68+
if (path[1] == 'p')
7069
{
71-
requestType = RequestType.Json;
70+
_requestType = RequestType.PlainText;
71+
return;
7272
}
73-
else if (path[1] == 'p')
73+
if (path[1] == 'j')
7474
{
75-
requestType = RequestType.PlainText;
75+
_requestType = RequestType.Json;
76+
return;
7677
}
7778
}
79+
}
80+
_requestType = RequestType.NotRecognized;
7881
#else
82+
var requestType = RequestType.NotRecognized;
83+
if (method == HttpMethod.Get)
84+
{
7985
var pathLength = path.Length;
8086
if (Paths.SingleQuery.Length <= pathLength && path.StartsWith(Paths.SingleQuery))
8187
{
@@ -95,10 +101,9 @@ public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> targe
95101
_queries = ParseQueries(path, Paths.MultipleQueries.Length);
96102
requestType = RequestType.MultipleQueries;
97103
}
98-
#endif
99104
}
100-
101105
_requestType = requestType;
106+
#endif
102107
}
103108

104109

0 commit comments

Comments
 (0)