typescript-sdk/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Glen Maddern 6f5e53b44b
Returning undefined from discoverOAuthMetadata for CORS errors (#717)
* Returning undefined from `discoverOAuthMetadata` for CORS errors

This behaviour was already happening for the root URL, but the new `fetchWithCorsRetry` logic differed.

The issue was if the server returns a 404 for `/.well-known/oauth-authorization-server/xyz` that didn't have the `access-control-allow-origin`, a TypeError was being thrown. There was logic there already to handle a TypeError for a _preflight_ request (cause by custom headers), but not the fallback. I refactored so all combinations return `undefined`.

* Add test for CORS error handling that should return undefined

This test covers the scenario where both the initial request with headers
and the retry without headers fail with CORS TypeErrors. The desired
behavior is to return undefined instead of throwing.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix test comment

---------

Co-authored-by: Glen Maddern <glen@glenmaddern.com>
Co-authored-by: Paul Carleton <paulc@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
2025-07-01 16:24:27 +01:00
..
__mocks__ Fix tests 2025-02-11 22:02:20 +00:00
client Returning undefined from discoverOAuthMetadata for CORS errors (#717) 2025-07-01 16:24:27 +01:00
examples Merge pull request #698 from RishiNandha/main 2025-06-30 16:31:42 +01:00
integration-tests update latest protocol version 2025-06-17 11:38:00 +01:00
server Merge branch 'main' into feat/structured-content-with-type-safety 2025-06-30 10:08:09 -04:00
shared Merge pull request #477 from nichtsam/pr/protocol-overwriting-transport-hooks 2025-06-26 14:04:16 +01:00
cli.ts Use eventsource package 2025-01-22 18:49:04 +00:00
inMemory.test.ts Pass extra object instead of authInfo directly 2025-04-12 16:38:55 -07:00
inMemory.ts Update inMemory.ts 2025-04-12 16:45:05 -07:00
types.test.ts change version 2025-06-17 17:29:41 +01:00
types.ts clean up tests - remove mockRequestInfo 2025-06-25 16:24:30 +03:00