diff --git a/src/YouTrackSharp/BearerTokenConnection.cs b/src/YouTrackSharp/BearerTokenConnection.cs
index 426a5df..aa8683d 100644
--- a/src/YouTrackSharp/BearerTokenConnection.cs
+++ b/src/YouTrackSharp/BearerTokenConnection.cs
@@ -2,6 +2,7 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using YouTrackSharp.Internal;
namespace YouTrackSharp
@@ -10,6 +11,7 @@ namespace YouTrackSharp
/// A class that represents a connection against a YouTrack server instance and provides an authenticated
/// that uses a bearer token.
///
+ [PublicAPI]
public class BearerTokenConnection
: Connection
{
@@ -19,6 +21,8 @@ public class BearerTokenConnection
private readonly string _bearerToken;
private readonly Action _configureHandler;
+
+ private TimeSpan _timeout = TimeSpan.FromSeconds(100);
///
/// Creates an instance of the class.
@@ -35,6 +39,25 @@ public BearerTokenConnection(string serverUrl, string bearerToken, Action
+ /// Gets or sets the timespan to wait before the request times out.
+ ///
+ ///
+ /// The default value is 100,000 milliseconds (100 seconds).
+ ///
+ public TimeSpan Timeout
+ {
+ get => _httpClient?.Timeout ?? _timeout;
+ set
+ {
+ _timeout = value;
+ if (_httpClient != null)
+ {
+ _httpClient.Timeout = _timeout;
+ }
+ }
+ }
///
public override async Task GetAuthenticatedHttpClient()
@@ -48,7 +71,8 @@ public override async Task GetAuthenticatedHttpClient()
_httpClient = new HttpClient(handler)
{
- BaseAddress = ServerUri
+ BaseAddress = ServerUri,
+ Timeout = _timeout
};
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(Constants.HttpContentTypes.ApplicationJson));