File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -60,16 +60,18 @@ describe("OAuth Authorization", () => {
60
60
// Verify second call was made without header
61
61
expect ( mockFetch ) . toHaveBeenCalledTimes ( 2 ) ;
62
62
const secondCallOptions = mockFetch . mock . calls [ 1 ] [ 1 ] ;
63
- expect ( secondCallOptions ) . toBeUndefined ( ) ; // No options means no headers
63
+ // The second call still has options but doesn't include MCP-Protocol-Version header
64
+ expect ( secondCallOptions ) . toBeDefined ( ) ;
65
+ expect ( secondCallOptions ?. headers ) . toBeUndefined ( ) ;
64
66
} ) ;
65
67
66
- it ( "returns undefined when all fetch attempts fail" , async ( ) => {
68
+ it ( "throws an error when all fetch attempts fail" , async ( ) => {
67
69
// Both requests fail
68
70
mockFetch . mockRejectedValueOnce ( new Error ( "Network error" ) ) ;
69
71
mockFetch . mockRejectedValueOnce ( new Error ( "Network error" ) ) ;
70
72
71
- const metadata = await discoverOAuthMetadata ( "https://auth.example.com" ) ;
72
- expect ( metadata ) . toBeUndefined ( ) ;
73
+ await expect ( discoverOAuthMetadata ( "https://auth.example.com" ) )
74
+ . rejects . toThrow ( "Network error" ) ;
73
75
expect ( mockFetch ) . toHaveBeenCalledTimes ( 2 ) ;
74
76
} ) ;
75
77
Original file line number Diff line number Diff line change @@ -75,13 +75,13 @@ export function clientRegistrationHandler({
75
75
}
76
76
77
77
const clientMetadata = parseResult . data ;
78
- const isPublicClient = clientMetadata . token_endpoint_auth_method ! == 'none'
78
+ const isPublicClient = clientMetadata . token_endpoint_auth_method = == 'none'
79
79
80
80
// Generate client credentials
81
81
const clientId = crypto . randomUUID ( ) ;
82
82
const clientSecret = isPublicClient
83
- ? crypto . randomBytes ( 32 ) . toString ( 'hex' )
84
- : undefined ;
83
+ ? undefined
84
+ : crypto . randomBytes ( 32 ) . toString ( 'hex' ) ;
85
85
const clientIdIssuedAt = Math . floor ( Date . now ( ) / 1000 ) ;
86
86
87
87
// Calculate client secret expiry time
You can’t perform that action at this time.
0 commit comments