Skip to content

Commit

Permalink
replacing null with an empty object hung off ApiConnection as suggest…
Browse files Browse the repository at this point in the history
…ed by @haacked
  • Loading branch information
davidalpert committed Aug 1, 2015
1 parent d458f8c commit 3f1bd13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Octokit.Tests/Clients/TeamsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public async Task AllowsEmptyBody()

connection.Received().Put<Dictionary<string, string>>(
Arg.Is<Uri>(u => u.ToString() == "teams/1/memberships/user"),
Arg.Is<string>(u => u == null));
Arg.Is<object>(u => u == ApiConnection.EmptyBody));
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Clients/TeamsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public async Task<TeamMembership> AddMembership(int id, string login)

try
{
response = await ApiConnection.Put<Dictionary<string, string>>(endpoint, null);
response = await ApiConnection.Put<Dictionary<string, string>>(endpoint, Octokit.ApiConnection.EmptyBody);
}
catch (NotFoundException)
{
Expand Down
3 changes: 3 additions & 0 deletions Octokit/Http/ApiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class ApiConnection : IApiConnection
{
readonly IApiPagination _pagination;

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible")]
public static object EmptyBody = new object();

/// <summary>
/// Initializes a new instance of the <see cref="ApiConnection"/> class.
/// </summary>
Expand Down

0 comments on commit 3f1bd13

Please sign in to comment.