You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e69c194
Browse filesBrowse the repository at this point in the historyBrowse files
committed
✨ Address review feedback on CORS preflight warning
- Remove the public export of corsPreflightReason to avoid adding
permanent public API surface for testing only.
- Extract collectCorsPreflightReasons and corsEnrichedErrorReason into
pure functions in cors.dart so the upload-listener, withCredentials,
and enriched-error branches are unit-testable without a browser.
- Add enableCORSWarning opt-out flag (defaults to true) so apps that
handle CORS correctly can silence the per-request warning.
- Add 8 unit tests covering the new pure functions.
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: GLM-5.2 <[email protected]>
@@ -252,20 +253,14 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
252
253
// Unfortunately, the underlying XMLHttpRequest API doesn't expose any
253
254
// specific information about the error itself.
254
255
// See also: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequestEventTarget/onerror
255
-
final baseReason ='The XMLHttpRequest onError callback was called. '
256
-
'This typically indicates an error on the network layer.';
257
-
final reason = preflightReasons.isEmpty
258
-
? baseReason
259
-
:'$baseReason If this is a cross-origin request, the browser may '
260
-
'have blocked it because the request is not a CORS "simple '
261
-
'request" (${preflightReasons.join('; ')}). Verify that the '
262
-
'server responds correctly to the CORS preflight (OPTIONS) '
0 commit comments