forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dotnet/corefx#2973 from davidsh/http_timeouts
Fix HttpClientHandler timeouts Commit migrated from dotnet/corefx@e6bc6a3
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Tests; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace System.Net.Http.Tests | ||
{ | ||
public class HttpClientTest | ||
{ | ||
[Fact] | ||
[OuterLoop] | ||
public void Timeout_SetTo60AndGetResponseFromServerWhichTakes40_Success() | ||
{ | ||
// TODO: This server path will change once the final test infrastructure is in place (Issue #1477). | ||
const string SlowServer = "http://httpbin.org/drip?numbytes=1&duration=1&delay=40&code=200"; | ||
|
||
using (var client = new HttpClient()) | ||
{ | ||
client.Timeout = TimeSpan.FromSeconds(60); | ||
var response = client.GetAsync(SlowServer).GetAwaiter().GetResult(); | ||
Assert.Equal(HttpStatusCode.OK, response.StatusCode); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters