Skip to content

Commit fa9198a

Browse files
MindaugasLaganeckasnmklotas
authored andcommitted
BUG FIX: repository keyword was missing in the request url (#51)
1 parent db8fe24 commit fa9198a

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/GitLabApiClient/TagClient.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,27 @@ internal TagClient(
2323
}
2424

2525
public async Task<Tag> GetAsync(string projectId, string tagName) =>
26-
await _httpFacade.Get<Tag>($"projects/{projectId}/repository/tags/{tagName}");
26+
await _httpFacade.Get<Tag>(TagsBaseUrl(projectId) + "/{tagName}");
2727

2828
public async Task<IList<Tag>> GetAsync(string projectId, Action<TagQueryOptions> options)
2929
{
3030
var queryOptions = new TagQueryOptions(projectId);
3131
options?.Invoke(queryOptions);
3232

33-
string url = _tagQueryBuilder.Build($"projects/{projectId}/tags", queryOptions);
33+
string url = _tagQueryBuilder.Build(TagsBaseUrl(projectId), queryOptions);
3434
return await _httpFacade.GetPagedList<Tag>(url);
3535
}
3636

3737
public async Task<Tag> CreateAsync(CreateTagRequest request) =>
38-
await _httpFacade.Post<Tag>($"projects/{request.ProjectId}/repository/tags", request);
38+
await _httpFacade.Post<Tag>(TagsBaseUrl(request.ProjectId), request);
3939

4040
public async Task DeleteAsync(DeleteTagRequest request) =>
41-
await _httpFacade.Delete($"projects/{request.ProjectId}/repository/tags/{request.TagName}");
41+
await _httpFacade.Delete(TagsBaseUrl(request.ProjectId) + "/{request.TagName}");
4242

43+
public static string TagsBaseUrl(string projectId)
44+
{
45+
string baseUrl = $"projects/{projectId}/repository/tags";
46+
return baseUrl;
47+
}
4348
}
4449
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using FluentAssertions;
2+
using Xunit;
3+
4+
namespace GitLabApiClient.Test
5+
{
6+
[Trait("Category", "LinuxIntegration")]
7+
[Collection("GitLabContainerFixture")]
8+
public class TagsClientTest
9+
{
10+
private const string ProjectId = "testProjectId";
11+
12+
[Fact]
13+
public void TagsBaseUrlTest()
14+
{
15+
string baseUrl = TagClient.TagsBaseUrl(ProjectId);
16+
baseUrl.Should().Be("projects/" + ProjectId + "/repository/tags");
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)