Repository: google/go-github
Pull request #1858 (2021-04-26 16:19:14)

Remove obsolete apps manifest preview custom header
Apps manifest are now out of preview and uses mediaTypeV3:

https://docs.github.com/en/rest/reference/apps#create-a-github-app-from-a-manifest


codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#1858](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (3037c66) into [master](https://codecov.io/gh/google/go-github/commit/cceb4d4573ea092c2396c038ff545cf8334dc498?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (cceb4d4) will **decrease** coverage by `0.00%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1858/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

```diff
@@            Coverage Diff             @@
##           master    #1858      +/-   ##
==========================================
- Coverage   97.64%   97.64%   -0.01%     
==========================================
  Files         105      105              
  Lines        6764     6763       -1     
==========================================
- Hits         6605     6604       -1     
  Misses         86       86              
  Partials       73       73              
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/apps\_manifest.go](https://codecov.io/gh/google/go-github/pull/1858/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2FwcHNfbWFuaWZlc3QuZ28=) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [cceb4d4...3037c66](https://codecov.io/gh/google/go-github/pull/1858?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

gmlewis: For future PRs, please do not use force push in this repo. See CONTRIBUTING.md for details. Thanks.

Patch:
diff --git a/github/apps_installation.go b/github/apps_installation.go
index 501d8006..521860d6 100644
--- a/github/apps_installation.go
+++ b/github/apps_installation.go
@@ -32,7 +32,11 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe
 	}
 
 	// TODO: remove custom Accept headers when APIs fully launch.
-	acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	acceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
 
 	var r *ListRepositories
@@ -62,7 +66,11 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
 	}
 
 	// TODO: remove custom Accept headers when APIs fully launch.
-	acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	acceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
 
 	var r *ListRepositories
diff --git a/github/apps_manifest.go b/github/apps_manifest.go
index 007decf3..defd6c0a 100644
--- a/github/apps_manifest.go
+++ b/github/apps_manifest.go
@@ -10,10 +10,6 @@ import (
 	"fmt"
 )
 
-const (
-	mediaTypeAppManifestPreview = "application/vnd.github.fury-preview+json"
-)
-
 // AppConfig describes the configuration of a GitHub App.
 type AppConfig struct {
 	ID            *int64     `json:"id,omitempty"`
@@ -41,7 +37,6 @@ func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*Ap
 	if err != nil {
 		return nil, nil, err
 	}
-	req.Header.Set("Accept", mediaTypeAppManifestPreview)
 
 	cfg := new(AppConfig)
 	resp, err := s.client.Do(ctx, req, cfg)


Test patch:
diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go
index 5e8a18de..c3b982a6 100644
--- a/github/apps_installation_test.go
+++ b/github/apps_installation_test.go
@@ -18,7 +18,11 @@ func TestAppsService_ListRepos(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	wantAcceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
 		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -55,7 +59,11 @@ func TestAppsService_ListUserRepos(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	wantAcceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
 		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go
index 461bb8d6..31d8c42a 100644
--- a/github/apps_manifest_test.go
+++ b/github/apps_manifest_test.go
@@ -30,7 +30,6 @@ func TestGetConfig(t *testing.T) {
 
 	mux.HandleFunc("/app-manifests/code/conversions", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "POST")
-		testHeader(t, r, "Accept", mediaTypeAppManifestPreview)
 		fmt.Fprint(w, manifestJSON)
 	})