Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IIssueLabelsClient.RemoveFromIssue() #1868

Merged
merged 1 commit into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Octokit.Tests/Reactive/ObservableIssuesLabelsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public void DeleteCorrectUrl()

client.RemoveFromIssue("fake", "repo", 42, "label");

connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels/label"), "application/vnd.github.symmetra-preview+json");
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels/label"), Arg.Any<object>(), "application/vnd.github.symmetra-preview+json");
}

[Fact]
Expand All @@ -379,7 +379,7 @@ public void DeleteCorrectUrlWithRepositoryId()

client.RemoveFromIssue(1, 42, "label");

connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/labels/label"), "application/vnd.github.symmetra-preview+json");
connection.Received().Delete<IReadOnlyList<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/labels/label"), Arg.Any<object>(), "application/vnd.github.symmetra-preview+json");
}

[Fact]
Expand Down
18 changes: 18 additions & 0 deletions Octokit/Http/ApiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,24 @@ public async Task<T> Delete<T>(Uri uri, object data)
return response.Body;
}

/// <summary>
/// Performs an asynchronous HTTP DELETE request.
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="accepts">Specifies accept response media type</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
public async Task<T> Delete<T>(Uri uri, string accepts)
{
Ensure.ArgumentNotNull(uri, nameof(uri));
Ensure.ArgumentNotNull(accepts, nameof(accepts));

var response = await Connection.Delete<T>(uri, null, accepts).ConfigureAwait(false);

return response.Body;
}

/// <summary>
/// Performs an asynchronous HTTP DELETE request.
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
Expand Down
10 changes: 10 additions & 0 deletions Octokit/Http/IApiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,16 @@ public interface IApiConnection
/// <param name="data">The object to serialize as the body of the request</param>
Task<T> Delete<T>(Uri uri, object data);

/// <summary>
/// Performs an asynchronous HTTP DELETE request.
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
/// </summary>
/// <typeparam name="T">The API resource's type.</typeparam>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="accepts">Specifies accept response media type</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
Task<T> Delete<T>(Uri uri, string accepts);

/// <summary>
/// Performs an asynchronous HTTP DELETE request.
/// Attempts to map the response body to an object of type <typeparamref name="T"/>
Expand Down