Skip to content

Commit

Permalink
fix: fix prefix and suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinyouzeng committed Aug 26, 2024
1 parent 7abfc98 commit a3b3373
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public static void AddHttpClientFilter(this Action<HttpClientTraceInstrumentatio
}

internal static bool IsHttpRequestMessageFilter(HttpRequestMessage httpRequestMessage) => !(FilterConsts.IsInterruptSignalrTracing && IsWebsocket(httpRequestMessage)
|| IsReuqestPathMatchHttpRequestSuffix(httpRequestMessage, FilterConsts.CommonIgnorePrefix)
|| IsReuqestPathMatchPrefix(httpRequestMessage, FilterConsts.CommonIgnoreSuffix)
|| IsReuqestPathMatchHttpRequestSuffix(httpRequestMessage, FilterConsts.CommonIgnoreSuffix)
|| IsReuqestPathMatchPrefix(httpRequestMessage, FilterConsts.CommonIgnorePrefix)
|| IsReuqestPathMatch(httpRequestMessage, FilterConsts.CommonIgnore));

internal static bool IsWebsocket(HttpRequestMessage httpRequestMessage)
Expand All @@ -27,14 +27,14 @@ internal static bool IsWebsocket(HttpRequestMessage httpRequestMessage)
return false;
}

private static bool IsReuqestPathMatchHttpRequestSuffix(HttpRequestMessage httpRequestMessage, List<string> prefix)
private static bool IsReuqestPathMatchHttpRequestSuffix(HttpRequestMessage httpRequestMessage, List<string> suffix)
{
return httpRequestMessage.RequestUri != null && !string.IsNullOrEmpty(httpRequestMessage.RequestUri.PathAndQuery) && prefix.Exists(httpRequestMessage.RequestUri.AbsolutePath.ToLower().StartsWith);
return httpRequestMessage.RequestUri != null && !string.IsNullOrEmpty(httpRequestMessage.RequestUri.PathAndQuery) && suffix.Exists(httpRequestMessage.RequestUri.AbsolutePath.ToLower().EndsWith);
}

private static bool IsReuqestPathMatchPrefix(HttpRequestMessage httpRequestMessage, List<string> suffix)
private static bool IsReuqestPathMatchPrefix(HttpRequestMessage httpRequestMessage, List<string> prefix)
{
return httpRequestMessage.RequestUri != null && !string.IsNullOrEmpty(httpRequestMessage.RequestUri.PathAndQuery) && suffix.Exists(httpRequestMessage.RequestUri.AbsolutePath.ToLower().EndsWith);
return httpRequestMessage.RequestUri != null && !string.IsNullOrEmpty(httpRequestMessage.RequestUri.PathAndQuery) && prefix.Exists(httpRequestMessage.RequestUri.AbsolutePath.ToLower().StartsWith);
}

private static bool IsReuqestPathMatch(HttpRequestMessage httpRequestMessage, List<string> pathes)
Expand Down

0 comments on commit a3b3373

Please sign in to comment.