Skip to content

Commit 7f64d4b

Browse files
committed
introduce query parser to handle watch in query
1 parent 2aadaba commit 7f64d4b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/KubernetesClient.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</ItemGroup>
99
<ItemGroup>
1010
<PackageReference Include="BouncyCastle.NetCore" Version="1.8.1.3" />
11+
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="1.1.2" />
1112
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="3.0.3" />
1213
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
1314
<PackageReference Include="YamlDotNet.NetCore" Version="1.0.0" />

src/WatcherDelegatingHandler.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System.IO;
2+
using System.Linq;
23
using System.Net;
34
using System.Net.Http;
45
using System.Threading;
56
using System.Threading.Tasks;
7+
using Microsoft.AspNetCore.WebUtilities;
68

79
namespace k8s
810
{
@@ -15,7 +17,9 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
1517

1618
if (originResponse.IsSuccessStatusCode)
1719
{
18-
if ($"{request.RequestUri.Query}".Contains("watch=true"))
20+
var query = QueryHelpers.ParseQuery(request.RequestUri.Query);
21+
22+
if (query.TryGetValue("watch", out var values) && values.Any(v => v == "true"))
1923
{
2024
originResponse.Content = new LineSeparatedHttpContent(originResponse.Content);
2125
}

0 commit comments

Comments
 (0)