Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion httpbin/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func loadConfig(args []string, getEnvVal func(string) string, getEnviron func()
}

// helper to generate a new ConfigError to return
configErr := func(format string, a ...interface{}) error {
configErr := func(format string, a ...any) error {
return ConfigError{
Err: fmt.Errorf(format, a...),
Usage: usage,
Expand Down
2 changes: 0 additions & 2 deletions httpbin/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ func TestLoadConfig(t *testing.T) {
}

for name, tc := range testCases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -617,7 +616,6 @@ func TestMainImpl(t *testing.T) {
}

for name, tc := range testCases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 0 additions & 3 deletions httpbin/digest/digest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func TestHash(t *testing.T) {
{digestAlgorithm(10), []byte("hello, world!\n"), "910c8bc73110b0cd1bc5d2bcae782511"},
}
for _, test := range tests {
test := test
t.Run(fmt.Sprintf("hash/%v", test.algorithm), func(t *testing.T) {
t.Parallel()
result := hash(test.data, test.algorithm)
Expand Down Expand Up @@ -180,7 +179,6 @@ func TestParseDictHeader(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.input, func(t *testing.T) {
t.Parallel()
results := parseDictHeader(test.input)
Expand Down Expand Up @@ -272,7 +270,6 @@ func TestParseAuthorizationHeader(t *testing.T) {
}

for i, test := range tests {
test := test
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
t.Parallel()
got := parseAuthorizationHeader(test.input)
Expand Down
10 changes: 5 additions & 5 deletions httpbin/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func createSpecialCases(prefix string) map[int]*statusCase {
]
}
`)
statusHTTP300body := []byte(fmt.Sprintf(`<!doctype html>
statusHTTP300body := fmt.Appendf(nil, `<!doctype html>
<head>
<title>Multiple Choices</title>
</head>
Expand All @@ -198,15 +198,15 @@ func createSpecialCases(prefix string) map[int]*statusCase {
<li><a href="%[1]s/image/png">/image/png</a></li>
<li><a href="%[1]s/image/svg">/image/svg</a></li>
</body>
</html>`, prefix))
</html>`, prefix)

statusHTTP308Body := []byte(fmt.Sprintf(`<!doctype html>
statusHTTP308Body := fmt.Appendf(nil, `<!doctype html>
<head>
<title>Permanent Redirect</title>
</head>
<body>Permanently redirected to <a href="%[1]s/image/jpeg">%[1]s/image/jpeg</a>
</body>
</html>`, prefix))
</html>`, prefix)

return map[int]*statusCase{
300: {
Expand Down Expand Up @@ -1004,7 +1004,7 @@ func (h *HTTPBin) doLinksPage(w http.ResponseWriter, _ *http.Request, n int, off
w.WriteHeader(http.StatusOK)

w.Write([]byte("<html><head><title>Links</title></head><body>"))
for i := 0; i < n; i++ {
for i := range n {
if i == offset {
fmt.Fprintf(w, "%d ", i)
} else {
Expand Down
Loading
Loading