@@ -43,6 +43,22 @@ public int AttemptCount
4343 set { field = value < 0 ? 3 : value ; }
4444 } = 3 ;
4545
46+ /// <summary>
47+ /// The timespan to wait before the request times out.
48+ /// </summary>
49+ public TimeSpan Timeout
50+ {
51+ get => _internalClient . Timeout ;
52+ set
53+ {
54+ // Ensure a positive timespan
55+ if ( value <= TimeSpan . Zero )
56+ value = TimeSpan . FromSeconds ( 30 ) ;
57+
58+ _internalClient . Timeout = value ;
59+ }
60+ }
61+
4662 /// <summary>
4763 /// Internal client for interaction
4864 /// </summary>
@@ -57,33 +73,14 @@ public int AttemptCount
5773 /// <summary>
5874 /// Constructor
5975 /// </summary>
60- public RedumpClient ( int timeoutSeconds = 30 )
76+ public RedumpClient ( )
6177 {
62- // Ensure a positive timespan
63- if ( timeoutSeconds <= 0 )
64- timeoutSeconds = 30 ;
65-
66- #if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
67- _internalClient = new CookieWebClient ( ) { Timeout = TimeSpan . FromSeconds ( timeoutSeconds ) } ;
68- #else
69- _internalClient = new HttpClient ( new HttpClientHandler { UseCookies = true } ) { Timeout = TimeSpan . FromSeconds ( timeoutSeconds ) } ;
70- #endif
71- }
72-
73- /// <summary>
74- /// Constructor
75- /// </summary>
76- public RedumpClient ( TimeSpan timeout )
77- {
78- // Ensure a positive timespan
79- if ( timeout <= TimeSpan . Zero )
80- timeout = TimeSpan . FromSeconds ( 30 ) ;
81-
8278#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
83- _internalClient = new CookieWebClient ( ) { Timeout = timeout } ;
79+ _internalClient = new CookieWebClient ( ) ;
8480#else
85- _internalClient = new HttpClient ( new HttpClientHandler { UseCookies = true } ) { Timeout = timeout } ;
81+ _internalClient = new HttpClient ( new HttpClientHandler { UseCookies = true } ) ;
8682#endif
83+ Timeout = TimeSpan . FromSeconds ( 30 ) ;
8784 }
8885
8986 #region Credentials
0 commit comments