Skip to content

Commit 17f7ee4

Browse files
authored
docs: Use secure URLs in string literals (#3657)
1 parent f46ce36 commit 17f7ee4

9 files changed

+33
-33
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ file.
8585
[REVIEWERS][] takes a look by mentioning them in a PR comment.
8686

8787
[forking]: https://help.github.com/articles/fork-a-repo
88-
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
88+
[well-formed commit messages]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
8989
[pull request]: https://help.github.com/articles/creating-a-pull-request
9090
[monitored by codecov.io]: https://codecov.io/gh/google/go-github
9191
[REVIEWERS]: ./REVIEWERS

github/actions_artifacts_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects(
456456
})
457457
mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) {
458458
testMethod(t, r, "GET")
459-
http.Redirect(w, r, "http://github.com/artifact", http.StatusFound)
459+
http.Redirect(w, r, "https://github.com/artifact", http.StatusFound)
460460
})
461461

462462
ctx := context.Background()
@@ -467,7 +467,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects(
467467
if resp.StatusCode != http.StatusFound {
468468
t.Errorf("Actions.DownloadArtifact return status %d, want %d", resp.StatusCode, http.StatusFound)
469469
}
470-
want := "http://github.com/artifact"
470+
want := "https://github.com/artifact"
471471
if url.String() != want {
472472
t.Errorf("Actions.DownloadArtifact returned %+v, want %+v", url.String(), want)
473473
}

github/actions_workflow_jobs_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) {
207207

208208
mux.HandleFunc("/repos/o/r/actions/jobs/399444496/logs", func(w http.ResponseWriter, r *http.Request) {
209209
testMethod(t, r, "GET")
210-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
210+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
211211
})
212212

213213
ctx := context.Background()
@@ -218,7 +218,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) {
218218
if resp.StatusCode != http.StatusFound {
219219
t.Errorf("Actions.GetWorkflowJobLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
220220
}
221-
want := "http://github.com/a"
221+
want := "https://github.com/a"
222222
if url.String() != want {
223223
t.Errorf("Actions.GetWorkflowJobLogs returned %+v, want %+v", url.String(), want)
224224
}
@@ -267,7 +267,7 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_dontFollowRedi
267267

268268
mux.HandleFunc("/repos/o/r/actions/jobs/399444496/logs", func(w http.ResponseWriter, r *http.Request) {
269269
testMethod(t, r, "GET")
270-
http.Redirect(w, r, "http://github.com/a", http.StatusMovedPermanently)
270+
http.Redirect(w, r, "https://github.com/a", http.StatusMovedPermanently)
271271
})
272272

273273
ctx := context.Background()
@@ -310,7 +310,7 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_followRedirect
310310

311311
mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) {
312312
testMethod(t, r, "GET")
313-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
313+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
314314
})
315315

316316
ctx := context.Background()
@@ -323,7 +323,7 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_followRedirect
323323
t.Errorf("Actions.GetWorkflowJobLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
324324
}
325325

326-
want := "http://github.com/a"
326+
want := "https://github.com/a"
327327
if url.String() != want {
328328
t.Errorf("Actions.GetWorkflowJobLogs returned %+v, want %+v", url.String(), want)
329329
}

github/actions_workflow_runs_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs(t *testing.T) {
213213

214214
mux.HandleFunc("/repos/o/r/actions/runs/399444496/attempts/2/logs", func(w http.ResponseWriter, r *http.Request) {
215215
testMethod(t, r, "GET")
216-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
216+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
217217
})
218218

219219
ctx := context.Background()
@@ -224,7 +224,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs(t *testing.T) {
224224
if resp.StatusCode != http.StatusFound {
225225
t.Errorf("Actions.GetWorkflowRunAttemptLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
226226
}
227-
want := "http://github.com/a"
227+
want := "https://github.com/a"
228228
if url.String() != want {
229229
t.Errorf("Actions.GetWorkflowRunAttemptLogs returned %+v, want %+v", url.String(), want)
230230
}
@@ -262,7 +262,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_dontFol
262262

263263
mux.HandleFunc("/repos/o/r/actions/runs/399444496/attempts/2/logs", func(w http.ResponseWriter, r *http.Request) {
264264
testMethod(t, r, "GET")
265-
http.Redirect(w, r, "http://github.com/a", http.StatusMovedPermanently)
265+
http.Redirect(w, r, "https://github.com/a", http.StatusMovedPermanently)
266266
})
267267

268268
ctx := context.Background()
@@ -305,7 +305,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_followR
305305

306306
mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) {
307307
testMethod(t, r, "GET")
308-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
308+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
309309
})
310310

311311
ctx := context.Background()
@@ -318,7 +318,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_followR
318318
t.Errorf("Actions.GetWorkflowRunAttemptLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
319319
}
320320

321-
want := "http://github.com/a"
321+
want := "https://github.com/a"
322322
if url.String() != want {
323323
t.Errorf("Actions.GetWorkflowRunAttemptLogs returned %+v, want %+v", url.String(), want)
324324
}
@@ -524,7 +524,7 @@ func TestActionsService_GetWorkflowRunLogs(t *testing.T) {
524524

525525
mux.HandleFunc("/repos/o/r/actions/runs/399444496/logs", func(w http.ResponseWriter, r *http.Request) {
526526
testMethod(t, r, "GET")
527-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
527+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
528528
})
529529

530530
ctx := context.Background()
@@ -535,7 +535,7 @@ func TestActionsService_GetWorkflowRunLogs(t *testing.T) {
535535
if resp.StatusCode != http.StatusFound {
536536
t.Errorf("Actions.GetWorkflowRunLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
537537
}
538-
want := "http://github.com/a"
538+
want := "https://github.com/a"
539539
if url.String() != want {
540540
t.Errorf("Actions.GetWorkflowRunLogs returned %+v, want %+v", url.String(), want)
541541
}
@@ -573,7 +573,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_dontFollowRedi
573573

574574
mux.HandleFunc("/repos/o/r/actions/runs/399444496/logs", func(w http.ResponseWriter, r *http.Request) {
575575
testMethod(t, r, "GET")
576-
http.Redirect(w, r, "http://github.com/a", http.StatusMovedPermanently)
576+
http.Redirect(w, r, "https://github.com/a", http.StatusMovedPermanently)
577577
})
578578

579579
ctx := context.Background()
@@ -616,7 +616,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_followRedirect
616616

617617
mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) {
618618
testMethod(t, r, "GET")
619-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
619+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
620620
})
621621

622622
ctx := context.Background()
@@ -629,7 +629,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_followRedirect
629629
t.Errorf("Actions.GetWorkflowJobLogs returned status: %d, want %d", resp.StatusCode, http.StatusFound)
630630
}
631631

632-
want := "http://github.com/a"
632+
want := "https://github.com/a"
633633
if url.String() != want {
634634
t.Errorf("Actions.GetWorkflowJobLogs returned %+v, want %+v", url.String(), want)
635635
}

github/dependabot_alerts_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) {
309309
URL: Ptr("https://www.djangoproject.com/weblog/2018/feb/01/security-releases/"),
310310
},
311311
{
312-
URL: Ptr("http://www.securitytracker.com/id/1040422"),
312+
URL: Ptr("https://www.securitytracker.com/id/1040422"),
313313
},
314314
},
315315
PublishedAt: &Timestamp{publishedAt},
@@ -385,7 +385,7 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) {
385385
"url": "https://www.djangoproject.com/weblog/2018/feb/01/security-releases/"
386386
},
387387
{
388-
"url": "http://www.securitytracker.com/id/1040422"
388+
"url": "https://www.securitytracker.com/id/1040422"
389389
}
390390
],
391391
"published_at": "2018-10-03T21:13:54Z",

github/meta.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (c *Client) Octocat(ctx context.Context, message string) (string, *Response
160160

161161
// Zen returns a random line from The Zen of GitHub.
162162
//
163-
// See also: http://warpspire.com/posts/taste/
163+
// See also: https://warpspire.com/posts/taste/
164164
//
165165
// GitHub API docs: https://docs.github.com/rest/meta/meta#get-the-zen-of-github
166166
//

github/orgs_audit_log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type AuditEntry struct {
4343
HashedToken *string `json:"hashed_token,omitempty"`
4444
Org *string `json:"org,omitempty"`
4545
OrgID *int64 `json:"org_id,omitempty"`
46-
Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time).
46+
Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time).
4747
TokenID *int64 `json:"token_id,omitempty"`
4848
TokenScopes *string `json:"token_scopes,omitempty"`
4949
User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available).

github/repos_contents_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) {
887887

888888
mux.HandleFunc("/repos/o/r/tarball/yo", func(w http.ResponseWriter, r *http.Request) {
889889
testMethod(t, r, "GET")
890-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
890+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
891891
})
892892
ctx := context.Background()
893893
url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{Ref: "yo"}, 1)
@@ -897,7 +897,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) {
897897
if resp.StatusCode != http.StatusFound {
898898
t.Errorf("Repositories.GetArchiveLink returned status: %d, want %d", resp.StatusCode, http.StatusFound)
899899
}
900-
want := "http://github.com/a"
900+
want := "https://github.com/a"
901901
if url.String() != want {
902902
t.Errorf("Repositories.GetArchiveLink returned %+v, want %+v", url.String(), want)
903903
}
@@ -944,7 +944,7 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_dontFollowRed
944944

945945
mux.HandleFunc("/repos/o/r/tarball", func(w http.ResponseWriter, r *http.Request) {
946946
testMethod(t, r, "GET")
947-
http.Redirect(w, r, "http://github.com/a", http.StatusMovedPermanently)
947+
http.Redirect(w, r, "https://github.com/a", http.StatusMovedPermanently)
948948
})
949949
ctx := context.Background()
950950
_, resp, _ := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, 0)
@@ -985,7 +985,7 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_followRedirec
985985
})
986986
mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) {
987987
testMethod(t, r, "GET")
988-
http.Redirect(w, r, "http://github.com/a", http.StatusFound)
988+
http.Redirect(w, r, "https://github.com/a", http.StatusFound)
989989
})
990990
ctx := context.Background()
991991
url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, 1)
@@ -995,7 +995,7 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_followRedirec
995995
if resp.StatusCode != http.StatusFound {
996996
t.Errorf("Repositories.GetArchiveLink returned status: %d, want %d", resp.StatusCode, http.StatusFound)
997997
}
998-
want := "http://github.com/a"
998+
want := "https://github.com/a"
999999
if url.String() != want {
10001000
t.Errorf("Repositories.GetArchiveLink returned %+v, want %+v", url.String(), want)
10011001
}

github/repos_hooks_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func TestRepositoriesService_Subscribe(t *testing.T) {
580580
testFormValues(t, r, values{
581581
"hub.mode": "subscribe",
582582
"hub.topic": "https://github.com/o/r/events/push",
583-
"hub.callback": "http://postbin.org/123",
583+
"hub.callback": "http://localhost:8080/callback",
584584
"hub.secret": "test secret",
585585
})
586586
})
@@ -591,15 +591,15 @@ func TestRepositoriesService_Subscribe(t *testing.T) {
591591
"o",
592592
"r",
593593
"push",
594-
"http://postbin.org/123",
594+
"http://localhost:8080/callback",
595595
[]byte("test secret"),
596596
)
597597
if err != nil {
598598
t.Errorf("Repositories.Subscribe returned error: %v", err)
599599
}
600600

601601
testNewRequestAndDoFailure(t, "Subscribe", client, func() (*Response, error) {
602-
return client.Repositories.Subscribe(ctx, "o", "r", "push", "http://postbin.org/123", nil)
602+
return client.Repositories.Subscribe(ctx, "o", "r", "push", "http://localhost:8080", nil)
603603
})
604604
}
605605

@@ -613,7 +613,7 @@ func TestRepositoriesService_Unsubscribe(t *testing.T) {
613613
testFormValues(t, r, values{
614614
"hub.mode": "unsubscribe",
615615
"hub.topic": "https://github.com/o/r/events/push",
616-
"hub.callback": "http://postbin.org/123",
616+
"hub.callback": "http://localhost:8080/callback",
617617
"hub.secret": "test secret",
618618
})
619619
})
@@ -624,14 +624,14 @@ func TestRepositoriesService_Unsubscribe(t *testing.T) {
624624
"o",
625625
"r",
626626
"push",
627-
"http://postbin.org/123",
627+
"http://localhost:8080/callback",
628628
[]byte("test secret"),
629629
)
630630
if err != nil {
631631
t.Errorf("Repositories.Unsubscribe returned error: %v", err)
632632
}
633633

634634
testNewRequestAndDoFailure(t, "Unsubscribe", client, func() (*Response, error) {
635-
return client.Repositories.Unsubscribe(ctx, "o", "r", "push", "http://postbin.org/123", nil)
635+
return client.Repositories.Unsubscribe(ctx, "o", "r", "push", "http://localhost:8080/callback", nil)
636636
})
637637
}

0 commit comments

Comments
 (0)