Skip to content

Commit f5a4da1

Browse files
committed
Linter fixes and ctx no longer needed
1 parent ad023d6 commit f5a4da1

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

pkg/http/oauth/oauth.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package oauth
44

55
import (
6-
"context"
76
"fmt"
87
"net/http"
98
"strings"
@@ -59,7 +58,7 @@ type AuthHandler struct {
5958
}
6059

6160
// NewAuthHandler creates a new OAuth auth handler.
62-
func NewAuthHandler(ctx context.Context, cfg *Config, apiHost utils.APIHostResolver) (*AuthHandler, error) {
61+
func NewAuthHandler(cfg *Config, apiHost utils.APIHostResolver) (*AuthHandler, error) {
6362
if cfg == nil {
6463
cfg = &Config{}
6564
}

pkg/http/oauth/oauth_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestNewAuthHandler(t *testing.T) {
5353
t.Run(tc.name, func(t *testing.T) {
5454
t.Parallel()
5555

56-
handler, err := NewAuthHandler(t.Context(), tc.cfg, dotcomHost)
56+
handler, err := NewAuthHandler(tc.cfg, dotcomHost)
5757
require.NoError(t, err)
5858
require.NotNil(t, handler)
5959

@@ -451,7 +451,7 @@ func TestHandleProtectedResource(t *testing.T) {
451451
dotcomHost, err := utils.NewAPIHost("https://api.github.com")
452452
require.NoError(t, err)
453453

454-
handler, err := NewAuthHandler(t.Context(), tc.cfg, dotcomHost)
454+
handler, err := NewAuthHandler(tc.cfg, dotcomHost)
455455
require.NoError(t, err)
456456

457457
router := chi.NewRouter()
@@ -496,7 +496,7 @@ func TestRegisterRoutes(t *testing.T) {
496496
dotcomHost, err := utils.NewAPIHost("https://api.github.com")
497497
require.NoError(t, err)
498498

499-
handler, err := NewAuthHandler(t.Context(), &Config{
499+
handler, err := NewAuthHandler(&Config{
500500
BaseURL: "https://api.example.com",
501501
}, dotcomHost)
502502
require.NoError(t, err)
@@ -565,7 +565,7 @@ func TestProtectedResourceResponseFormat(t *testing.T) {
565565
dotcomHost, err := utils.NewAPIHost("https://api.github.com")
566566
require.NoError(t, err)
567567

568-
handler, err := NewAuthHandler(t.Context(), &Config{
568+
handler, err := NewAuthHandler(&Config{
569569
BaseURL: "https://api.example.com",
570570
}, dotcomHost)
571571
require.NoError(t, err)
@@ -676,11 +676,10 @@ func TestAPIHostResolver_AuthorizationServerURL(t *testing.T) {
676676
assert.Contains(t, err.Error(), tc.errorContains)
677677
}
678678
return
679-
} else {
680-
require.NoError(t, err)
681679
}
680+
require.NoError(t, err)
682681

683-
handler, err := NewAuthHandler(t.Context(), &Config{
682+
handler, err := NewAuthHandler(&Config{
684683
BaseURL: "https://api.example.com",
685684
}, apiHost)
686685
require.NoError(t, err)
@@ -708,7 +707,6 @@ func TestAPIHostResolver_AuthorizationServerURL(t *testing.T) {
708707
}
709708
return
710709
}
711-
require.NoError(t, err)
712710

713711
responseAuthServers, ok := response["authorization_servers"].([]any)
714712
require.True(t, ok)

pkg/http/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func RunHTTPServer(cfg ServerConfig) error {
136136

137137
r := chi.NewRouter()
138138
handler := NewHTTPMcpHandler(ctx, &cfg, deps, t, logger, apiHost, append(serverOptions, WithFeatureChecker(featureChecker), WithOAuthConfig(oauthCfg))...)
139-
oauthHandler, err := oauth.NewAuthHandler(ctx, oauthCfg, apiHost)
139+
oauthHandler, err := oauth.NewAuthHandler(oauthCfg, apiHost)
140140
if err != nil {
141141
return fmt.Errorf("failed to create OAuth handler: %w", err)
142142
}

0 commit comments

Comments
 (0)