Skip to content

Commit

Permalink
add accept header for teams client
Browse files Browse the repository at this point in the history
  • Loading branch information
martinscholz83 committed Jun 6, 2016
1 parent a3fafe9 commit 3ed011d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Octokit.Tests/Clients/TeamsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public void AddOrUpdatePermission()

client.AddRepository(1, "org", "repo", newPermission);

connection.Connection.Received().Put(Arg.Is<Uri>(u => u.ToString() == "teams/1/repos/org/repo"), Arg.Any<object>());
connection.Connection.Received().Put(Arg.Is<Uri>(u => u.ToString() == "teams/1/repos/org/repo"), Arg.Any<object>(), "application/vnd.github.ironman-preview+json");
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Octokit/Clients/TeamsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ public async Task<bool> AddRepository(int id, string organization, string repoNa

try
{
var httpStatusCode = await ApiConnection.Connection.Put(endpoint, permission).ConfigureAwait(false);
return httpStatusCode == HttpStatusCode.NoContent;
var httpStatusCode = await ApiConnection.Connection.Put<HttpStatusCode>(endpoint, permission, "", AcceptHeaders.OrganizationPermissionsPreview).ConfigureAwait(false);
return httpStatusCode.HttpResponse.StatusCode == HttpStatusCode.NoContent;
}
catch (NotFoundException)
{
Expand Down
15 changes: 0 additions & 15 deletions Octokit/Http/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,21 +404,6 @@ public async Task<HttpStatusCode> Put(Uri uri)
return response.HttpResponse.StatusCode;
}

/// <summary>
/// Performs an asynchronous HTTP PUT request that expects an empty response.
/// </summary>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="body">The object to serialize as the body of the request</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
public async Task<HttpStatusCode> Put(Uri uri, object body)
{
Ensure.ArgumentNotNull(uri, "uri");
Ensure.ArgumentNotNull(body, "body");

var response = await SendData<object>(uri, HttpMethod.Put, body, null, null, CancellationToken.None).ConfigureAwait(false);
return response.HttpResponse.StatusCode;
}

/// <summary>
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions Octokit/Http/IConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,6 @@ public interface IConnection : IApiInfoProvider
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
Task<HttpStatusCode> Put(Uri uri);

/// <summary>
/// Performs an asynchronous HTTP PUT request that expects an empty response.
/// </summary>
/// <param name="uri">URI endpoint to send request to</param>
/// <param name="body">The object to serialize as the body of the request</param>
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns>
Task<HttpStatusCode> Put(Uri uri, object body);

/// <summary>
/// Performs an asynchronous HTTP DELETE request that expects an empty response.
/// </summary>
Expand Down

0 comments on commit 3ed011d

Please sign in to comment.