Skip to content

Commit 17f7a66

Browse files
rassilonSreeshail1
authored andcommitted
Fix build error with respect to System.Web.HttpUtility.ParseQueryString.. wierd one..
1 parent ea8eba4 commit 17f7a66

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
@@ -85,8 +85,6 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
8585
await authenticator.Authenticate(this, request).ConfigureAwait(false);
8686
}
8787

88-
using var requestContent = new RequestContent(this, request);
89-
9088
var httpMethod = AsHttpMethod(request.Method);
9189
var url = this.BuildUri(request);
9290
var originalUrl = url;
@@ -133,7 +131,7 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
133131
// If we found coookies during a redirect,
134132
// we need to update the Cookie headers:
135133
if (foundCookies) {
136-
headers.AddCookieHeaders(cookieContainer, url);
134+
headers.AddCookieHeaders(url, cookieContainer);
137135
}
138136
using var message = PrepareRequestMessage(httpMethod, url, content, headers);
139137

@@ -205,21 +203,21 @@ async Task<HttpResponse> ExecuteRequestAsync(RestRequest request, CancellationTo
205203

206204
url = location;
207205

208-
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader)) {
206+
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader1)) {
209207
foundCookies = true;
210208
// ReSharper disable once PossibleMultipleEnumeration
211-
cookieContainer.AddCookies(url, cookiesHeader);
209+
cookieContainer.AddCookies(url, cookiesHeader1);
212210
// ReSharper disable once PossibleMultipleEnumeration
213-
Options.CookieContainer?.AddCookies(url, cookiesHeader);
211+
Options.CookieContainer?.AddCookies(url, cookiesHeader1);
214212
}
215213
} while (true);
216214

217215
// Parse all the cookies from the response and update the cookie jar with cookies
218-
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader)) {
216+
if (responseMessage.Headers.TryGetValues(KnownHeaders.SetCookie, out var cookiesHeader2)) {
219217
// ReSharper disable once PossibleMultipleEnumeration
220-
cookieContainer.AddCookies(url, cookiesHeader);
218+
cookieContainer.AddCookies(url, cookiesHeader2);
221219
// ReSharper disable once PossibleMultipleEnumeration
222-
Options.CookieContainer?.AddCookies(url, cookiesHeader);
220+
Options.CookieContainer?.AddCookies(url, cookiesHeader2);
223221
}
224222
}
225223
catch (Exception ex) {

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)