Skip to content

Commit ced795c

Browse files
committed
improve instantiation of YouTrackClient wrt BaseUrl
1 parent 3e879f5 commit ced795c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/YouTrackSharp/BearerTokenConnection.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ public override async Task<YouTrackClient> GetAuthenticatedApiClient()
9090
Timeout = _timeout
9191
};
9292

93-
_youTrackClient = new YouTrackClient(_httpClient)
94-
{
95-
BaseUrl = ServerUri.ToString().TrimEnd('/') + "/api/"
96-
};
93+
_youTrackClient = new YouTrackClient(_httpClient);
9794
}
9895

9996
// Authenticate?

src/YouTrackSharp/Generated/YouTrackSharp.Api.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ public partial class YouTrackClient
2727

2828
public string BaseUrl
2929
{
30-
get { return _baseUrl; }
30+
get
31+
{
32+
if (_baseUrl == null)
33+
{
34+
_baseUrl = _httpClient.BaseAddress.ToString().TrimEnd('/') + "/api/";
35+
};
36+
return _baseUrl;
37+
}
3138
set { _baseUrl = value; }
3239
}
3340

0 commit comments

Comments
 (0)