Skip to content

Commit 9320ca0

Browse files
committed
remove redundant checks in WithRequestConfig
1 parent d9e9bae commit 9320ca0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pkg/http/middleware/request_config.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ func WithRequestConfig(next http.Handler) http.Handler {
1414
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1515
ctx := r.Context()
1616

17-
// Only set from headers if not already set in ctx
18-
if !ghcontext.IsReadonly(ctx) {
19-
if relaxedParseBool(r.Header.Get(headers.MCPReadOnlyHeader)) {
20-
ctx = ghcontext.WithReadonly(ctx, true)
21-
}
17+
if relaxedParseBool(r.Header.Get(headers.MCPReadOnlyHeader)) {
18+
ctx = ghcontext.WithReadonly(ctx, true)
2219
}
2320

24-
if len(ghcontext.GetToolsets(ctx)) == 0 {
25-
if toolsets := headers.ParseCommaSeparated(r.Header.Get(headers.MCPToolsetsHeader)); len(toolsets) > 0 {
26-
ctx = ghcontext.WithToolsets(ctx, toolsets)
27-
}
21+
if toolsets := headers.ParseCommaSeparated(r.Header.Get(headers.MCPToolsetsHeader)); len(toolsets) > 0 {
22+
ctx = ghcontext.WithToolsets(ctx, toolsets)
2823
}
2924

3025
next.ServeHTTP(w, r.WithContext(ctx))

0 commit comments

Comments
 (0)