Skip to content

Commit 7555b0c

Browse files
committed
Move GetMethodAndUrl func out to MethodAndUrlUtils unit
1 parent 65e8cf7 commit 7555b0c

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

DevProxy.Plugins/Reporting/GraphMinimalPermissionsGuidancePlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public override async Task AfterRecordingStopAsync(RecordingArgs e, Cancellation
9393
}
9494

9595
var methodAndUrlString = request.Message;
96-
var methodAndUrl = GraphUtils.GetMethodAndUrl(methodAndUrlString);
96+
var methodAndUrl = MethodAndUrlUtils.GetMethodAndUrl(methodAndUrlString);
9797
if (methodAndUrl.Method.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase))
9898
{
9999
continue;

DevProxy.Plugins/Reporting/GraphMinimalPermissionsPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public override async Task AfterRecordingStopAsync(RecordingArgs e, Cancellation
7070
}
7171

7272
var methodAndUrlString = request.Message;
73-
var methodAndUrl = GraphUtils.GetMethodAndUrl(methodAndUrlString);
73+
var methodAndUrl = MethodAndUrlUtils.GetMethodAndUrl(methodAndUrlString);
7474
if (methodAndUrl.Method.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase))
7575
{
7676
continue;

DevProxy.Plugins/Utils/GraphUtils.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
namespace DevProxy.Plugins.Utils;
1414

15-
internal readonly record struct MethodAndUrl(string Method, string Url);
16-
1715
sealed class GraphUtils(
1816
HttpClient httpClient,
1917
ILogger<GraphUtils> logger)
@@ -102,18 +100,6 @@ internal async Task<IEnumerable<string>> UpdateUserScopesAsync(IEnumerable<strin
102100
return newMinimalScopes;
103101
}
104102

105-
internal static MethodAndUrl GetMethodAndUrl(string methodAndUrlString)
106-
{
107-
ArgumentException.ThrowIfNullOrWhiteSpace(methodAndUrlString);
108-
109-
var info = methodAndUrlString.Split(" ");
110-
if (info.Length > 2)
111-
{
112-
info = [info[0], string.Join(" ", info.Skip(1))];
113-
}
114-
return new(Method: info[0], Url: info[1]);
115-
}
116-
117103
internal static string GetTokenizedUrl(string absoluteUrl)
118104
{
119105
var sanitizedUrl = ProxyUtils.SanitizeUrl(absoluteUrl);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace DevProxy.Plugins.Utils;
6+
7+
internal readonly record struct MethodAndUrl(string Method, string Url);
8+
9+
static class MethodAndUrlUtils
10+
{
11+
internal static MethodAndUrl GetMethodAndUrl(string methodAndUrlString)
12+
{
13+
ArgumentException.ThrowIfNullOrWhiteSpace(methodAndUrlString);
14+
15+
var info = methodAndUrlString.Split(" ");
16+
if (info.Length > 2)
17+
{
18+
info = [info[0], string.Join(" ", info.Skip(1))];
19+
}
20+
return new(Method: info[0], Url: info[1]);
21+
}
22+
}

0 commit comments

Comments
 (0)