File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 11package ghmcp
22
33import (
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
5657func 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}
You can’t perform that action at this time.
0 commit comments