Skip to content

Commit

Permalink
improve instantiation of YouTrackClient wrt BaseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
rekolobov committed Jul 27, 2021
1 parent 3e879f5 commit ced795c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/YouTrackSharp/BearerTokenConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ public override async Task<YouTrackClient> GetAuthenticatedApiClient()
Timeout = _timeout
};

_youTrackClient = new YouTrackClient(_httpClient)
{
BaseUrl = ServerUri.ToString().TrimEnd('/') + "/api/"
};
_youTrackClient = new YouTrackClient(_httpClient);
}

// Authenticate?
Expand Down
9 changes: 8 additions & 1 deletion src/YouTrackSharp/Generated/YouTrackSharp.Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ public partial class YouTrackClient

public string BaseUrl
{
get { return _baseUrl; }
get
{
if (_baseUrl == null)
{
_baseUrl = _httpClient.BaseAddress.ToString().TrimEnd('/') + "/api/";
};
return _baseUrl;
}
set { _baseUrl = value; }
}

Expand Down

0 comments on commit ced795c

Please sign in to comment.