Skip to content

Commit 0db3d87

Browse files
committed
Fix build error with respect to System.Web.HttpUtility.ParseQueryString.. wierd one..
1 parent df851af commit 0db3d87

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/RestSharp/RestClient.Async.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
8484
await authenticator.Authenticate(this, request).ConfigureAwait(false);
8585
}
8686

87-
using var requestContent = new RequestContent(this, request);
88-
8987
var httpMethod = AsHttpMethod(request.Method);
9088
var url = this.BuildUri(request);
9189
var originalUrl = url;
@@ -116,7 +114,7 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
116114
// If we found coookies during a redirect,
117115
// we need to update the Cookie headers:
118116
if (foundCookies) {
119-
headers.AddCookieHeaders(cookieContainer, url);
117+
headers.AddCookieHeaders(url, cookieContainer);
120118
}
121119
using var message = PrepareRequestMessage(httpMethod, url, content, headers);
122120

@@ -188,21 +186,21 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
188186

189187
url = location;
190188

191-
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader)) {
189+
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader1)) {
192190
foundCookies = true;
193191
// ReSharper disable once PossibleMultipleEnumeration
194-
cookieContainer.AddCookies(url, cookiesHeader);
192+
cookieContainer.AddCookies(url, cookiesHeader1);
195193
// ReSharper disable once PossibleMultipleEnumeration
196-
Options.CookieContainer?.AddCookies(url, cookiesHeader);
194+
Options.CookieContainer?.AddCookies(url, cookiesHeader1);
197195
}
198196
} while (true);
199197

200198
// Parse all the cookies from the response and update the cookie jar with cookies
201-
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader)) {
199+
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader2)) {
202200
// ReSharper disable once PossibleMultipleEnumeration
203-
cookieContainer.AddCookies(url, cookiesHeader);
201+
cookieContainer.AddCookies(url, cookiesHeader2);
204202
// ReSharper disable once PossibleMultipleEnumeration
205-
Options.CookieContainer?.AddCookies(url, cookiesHeader);
203+
Options.CookieContainer?.AddCookies(url, cookiesHeader2);
206204
}
207205

208206
if (request.OnAfterRequest != null) await request.OnAfterRequest(responseMessage).ConfigureAwait(false);

test/RestSharp.InteractiveTests/AuthenticationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Net;
2+
using System.Text;
23
using System.Web;
34
using RestSharp.Authenticators;
45

@@ -30,7 +31,7 @@ public static async Task Can_Authenticate_With_OAuth_Async_With_Callback(Twitter
3031
Assert.NotNull(response);
3132
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
3233

33-
var qs = HttpUtility.ParseQueryString(response.Content);
34+
var qs = HttpUtility.ParseQueryString(response.Content, Encoding.UTF8);
3435
var oauthToken = qs["oauth_token"];
3536
var oauthTokenSecret = qs["oauth_token_secret"];
3637

test/RestSharp.Tests/RestSharp.Tests.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<ItemGroup>
88
<ProjectReference Include="$(RepoRoot)\src\RestSharp\RestSharp.csproj" />
99
</ItemGroup>
10+
<ItemGroup>
11+
<Reference Include="System.Net">
12+
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.dll</HintPath>
13+
</Reference>
14+
<Reference Include="System.Web">
15+
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Web.dll</HintPath>
16+
</Reference>
17+
</ItemGroup>
1018
<ItemGroup>
1119
<None Update="SampleData\4sq.json" CopyToOutputDirectory="PreserveNewest" />
1220
<None Update="SampleData\bearertoken.json" CopyToOutputDirectory="PreserveNewest" />

0 commit comments

Comments
 (0)