Skip to content

Commit ed4a63c

Browse files
committed
fix: fixed lint errors
1 parent fc340b4 commit ed4a63c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

internal/ghmcp/http_server.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,15 @@ func RunHTTPServer(cfg HTTPServerConfig) error {
9595
if logFile != nil {
9696
defer func() { _ = logFile.Close() }()
9797
}
98-
httpServer := &http.Server{Addr: listenAddress}
98+
httpServer := &http.Server{
99+
Addr: listenAddress,
100+
ReadHeaderTimeout: 10 * time.Second,
101+
}
99102

100103
streamServer := server.NewStreamableHTTPServer(
101104
ghServer,
102105
server.WithStreamableHTTPServer(httpServer),
103-
server.WithHTTPContextFunc(func(ctx context.Context, r *http.Request) context.Context {
106+
server.WithHTTPContextFunc(func(ctx context.Context, _ *http.Request) context.Context {
104107
return pkgErrors.ContextWithGitHubErrors(ctx)
105108
}),
106109
)

internal/ghmcp/http_server_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package ghmcp
22

33
import (
4+
"context"
45
"net/http"
56
"net/http/httptest"
67
"testing"
@@ -37,7 +38,7 @@ func TestTokenMiddlewareRejectsInvalidAuthorization(t *testing.T) {
3738

3839
for name, header := range cases {
3940
t.Run(name, func(t *testing.T) {
40-
handler := tokenMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
41+
handler := tokenMiddleware(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
4142
t.Fatalf("handler should not be called")
4243
}))
4344

@@ -54,11 +55,11 @@ func TestTokenMiddlewareRejectsInvalidAuthorization(t *testing.T) {
5455
}
5556

5657
func TestTokenContextHelpers(t *testing.T) {
57-
ctx := ContextWithToken(nil, " token-value ")
58+
ctx := ContextWithToken(context.TODO(), " token-value ")
5859
token, err := TokenFromContext(ctx)
5960
require.NoError(t, err)
6061
require.Equal(t, "token-value", token)
6162

62-
_, err = TokenFromContext(nil)
63+
_, err = TokenFromContext(context.TODO())
6364
require.Error(t, err)
6465
}

0 commit comments

Comments
 (0)