mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
Fix RepositoryCommitsClient.GetSha1 API call after preview period ended (#1654)
* Change GetSha1 for commit API call to use official media type accept header rather than preview header (which doesn't seem to work anymore) * Missed 2 unit tests
This commit is contained in:
@@ -1062,7 +1062,7 @@ namespace Octokit.Tests.Clients
|
||||
client.GetSha1("owner", "name", "reference");
|
||||
|
||||
connection.Received()
|
||||
.Get<string>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/commits/reference"), null, AcceptHeaders.CommitReferenceSha1Preview);
|
||||
.Get<string>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/commits/reference"), null, "application/vnd.github.v3.sha");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Octokit.Tests.Clients
|
||||
await client.GetSha1("fake", "repo", "ref");
|
||||
|
||||
connection.Received().Get<string>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits/ref"),
|
||||
null, "application/vnd.github.chitauri-preview+sha");
|
||||
null, "application/vnd.github.v3.sha");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -330,7 +330,7 @@ namespace Octokit.Tests.Clients
|
||||
await client.GetSha1(1, "ref");
|
||||
|
||||
connection.Received().Get<string>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/commits/ref"),
|
||||
null, "application/vnd.github.chitauri-preview+sha");
|
||||
null, "application/vnd.github.v3.sha");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(owner, name, reference), null, AcceptHeaders.CommitReferenceSha1Preview);
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(owner, name, reference), null, AcceptHeaders.CommitReferenceSha1MediaType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -202,7 +202,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(repositoryId, reference), null, AcceptHeaders.CommitReferenceSha1Preview);
|
||||
return ApiConnection.Get<string>(ApiUrls.RepositoryCommit(repositoryId, reference), null, AcceptHeaders.CommitReferenceSha1MediaType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ namespace Octokit
|
||||
|
||||
public const string RedirectsPreviewThenStableVersionJson = "application/vnd.github.quicksilver-preview+json; charset=utf-8, application/vnd.github.v3+json; charset=utf-8";
|
||||
|
||||
public const string CommitReferenceSha1MediaType = "application/vnd.github.v3.sha";
|
||||
|
||||
public const string OrganizationPermissionsPreview = "application/vnd.github.ironman-preview+json";
|
||||
|
||||
public const string LicensesApiPreview = "application/vnd.github.drax-preview+json";
|
||||
@@ -19,9 +21,7 @@ namespace Octokit
|
||||
public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
|
||||
|
||||
public const string IssueLockingUnlockingApiPreview = "application/vnd.github.the-key-preview+json";
|
||||
|
||||
public const string CommitReferenceSha1Preview = "application/vnd.github.chitauri-preview+sha";
|
||||
|
||||
|
||||
public const string SquashCommitPreview = "application/vnd.github.polaris-preview+json";
|
||||
|
||||
public const string MigrationsApiPreview = "application/vnd.github.wyandotte-preview+json";
|
||||
|
||||
Reference in New Issue
Block a user