From 3ed011dfd4f704946eb7f91b141dba6030cbe73e Mon Sep 17 00:00:00 2001 From: maddin2016 Date: Mon, 6 Jun 2016 15:50:14 +0200 Subject: [PATCH] add accept header for teams client --- Octokit.Tests/Clients/TeamsClientTests.cs | 2 +- Octokit/Clients/TeamsClient.cs | 4 ++-- Octokit/Http/Connection.cs | 15 --------------- Octokit/Http/IConnection.cs | 8 -------- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/Octokit.Tests/Clients/TeamsClientTests.cs b/Octokit.Tests/Clients/TeamsClientTests.cs index c08c640a8b..31806b0c40 100644 --- a/Octokit.Tests/Clients/TeamsClientTests.cs +++ b/Octokit.Tests/Clients/TeamsClientTests.cs @@ -309,7 +309,7 @@ public void AddOrUpdatePermission() client.AddRepository(1, "org", "repo", newPermission); - connection.Connection.Received().Put(Arg.Is(u => u.ToString() == "teams/1/repos/org/repo"), Arg.Any()); + connection.Connection.Received().Put(Arg.Is(u => u.ToString() == "teams/1/repos/org/repo"), Arg.Any(), "application/vnd.github.ironman-preview+json"); } [Fact] diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs index 25d986e9f3..e23f3ba243 100644 --- a/Octokit/Clients/TeamsClient.cs +++ b/Octokit/Clients/TeamsClient.cs @@ -335,8 +335,8 @@ public async Task 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(endpoint, permission, "", AcceptHeaders.OrganizationPermissionsPreview).ConfigureAwait(false); + return httpStatusCode.HttpResponse.StatusCode == HttpStatusCode.NoContent; } catch (NotFoundException) { diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index 229849f777..7a8a203f18 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -404,21 +404,6 @@ public async Task Put(Uri uri) return response.HttpResponse.StatusCode; } - /// - /// Performs an asynchronous HTTP PUT request that expects an empty response. - /// - /// URI endpoint to send request to - /// The object to serialize as the body of the request - /// The returned - public async Task Put(Uri uri, object body) - { - Ensure.ArgumentNotNull(uri, "uri"); - Ensure.ArgumentNotNull(body, "body"); - - var response = await SendData(uri, HttpMethod.Put, body, null, null, CancellationToken.None).ConfigureAwait(false); - return response.HttpResponse.StatusCode; - } - /// /// Performs an asynchronous HTTP DELETE request that expects an empty response. /// diff --git a/Octokit/Http/IConnection.cs b/Octokit/Http/IConnection.cs index d89c22c350..39ddac533c 100644 --- a/Octokit/Http/IConnection.cs +++ b/Octokit/Http/IConnection.cs @@ -197,14 +197,6 @@ public interface IConnection : IApiInfoProvider /// The returned Task Put(Uri uri); - /// - /// Performs an asynchronous HTTP PUT request that expects an empty response. - /// - /// URI endpoint to send request to - /// The object to serialize as the body of the request - /// The returned - Task Put(Uri uri, object body); - /// /// Performs an asynchronous HTTP DELETE request that expects an empty response. ///