Skip to content

Commit 903be14

Browse files
authored
Add API and Web to meta api endpoint (#2435)
1 parent acca0b6 commit 903be14

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

github/misc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ type APIMeta struct {
176176

177177
// An array of SSH keys.
178178
SSHKeys []string `json:"ssh_keys,omitempty"`
179+
180+
// An array of IP addresses in CIDR format specifying the addresses
181+
// which serve GitHub websites.
182+
Web []string `json:"web,omitempty"`
183+
184+
// An array of IP addresses in CIDR format specifying the addresses
185+
// which serve GitHub APIs.
186+
API []string `json:"api,omitempty"`
179187
}
180188

181189
// APIMeta returns information about GitHub.com, the service. Or, if you access

github/misc_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ func TestAPIMeta_Marshal(t *testing.T) {
190190
Dependabot: []string{"d"},
191191
SSHKeyFingerprints: map[string]string{"a": "f"},
192192
SSHKeys: []string{"k"},
193+
API: []string{"a"},
194+
Web: []string{"w"},
193195
}
194196
want := `{
195197
"hooks":["h"],
@@ -200,7 +202,9 @@ func TestAPIMeta_Marshal(t *testing.T) {
200202
"actions":["a"],
201203
"dependabot":["d"],
202204
"ssh_key_fingerprints":{"a":"f"},
203-
"ssh_keys":["k"]
205+
"ssh_keys":["k"],
206+
"api":["a"],
207+
"web":["w"]
204208
}`
205209

206210
testJSONMarshal(t, a, want)
@@ -212,7 +216,7 @@ func TestAPIMeta(t *testing.T) {
212216

213217
mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
214218
testMethod(t, r, "GET")
215-
fmt.Fprint(w, `{"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`)
219+
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`)
216220
})
217221

218222
ctx := context.Background()
@@ -228,6 +232,8 @@ func TestAPIMeta(t *testing.T) {
228232
Importer: []string{"i"},
229233
Actions: []string{"a"},
230234
Dependabot: []string{"d"},
235+
API: []string{"a"},
236+
Web: []string{"w"},
231237

232238
VerifiablePasswordAuthentication: Bool(true),
233239
}

0 commit comments

Comments
 (0)