Skip to content

Commit f59b3b7

Browse files
authored
doc: add docs for synchronous XHR requests (#6332)
1 parent 0da8d60 commit f59b3b7

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/app/references/error-messages.mdx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,10 @@ read a unique identifier from your CI provider as described in our
801801

802802
You may encounter this error if Cypress is detecting the exact same CI Build ID
803803
matching a previous CI Build ID in a run that was completed over 24 hours ago.
804-
You cannot run tests on a run that has been complete for that long. ​ ​You can
804+
You cannot run tests on a run that has been complete for that long. You can
805805
see the CI Build ID that is detected for each completed run by looking at the
806806
details section at the top of your run in
807-
[Cypress Cloud](https://on.cypress.io/cloud). ​ ​You can generate and pass in
807+
[Cypress Cloud](https://on.cypress.io/cloud). You can generate and pass in
808808
your own unique CI Build ID per run as described
809809
[here](/app/references/command-line#cypress-run-ci-build-id-lt-id-gt).
810810

@@ -946,6 +946,32 @@ there.
946946
It's possible to enable debugging these scripts by adding the `crossorigin`
947947
attribute and setting a `CORS` header.
948948

949+
### <Icon name="exclamation-triangle" color="red" /> Synchronous XHR requests
950+
951+
:::caution
952+
953+
<strong>Note</strong>
954+
955+
Synchronous XHR requests often cause hangs on the web, especially with poor network conditions or when the remote server is slow to respond. Synchronous XHR is now deprecated and should be avoided in favor of asynchronous requests.
956+
957+
:::
958+
959+
When using synchronous XHR requests, you may see the following warnings:
960+
961+
> **Warning: Synchronous XHR request was not intercepted: http://example.com.**
962+
963+
Cypress is unable to intercept a synchronous XHR request if the [`cy.intercept()`](/api/commands/intercept) is using a [`routeHandler`](/api/commands/intercept#routeHandler-Function).
964+
Thus, the [`routeHandler`](/api/commands/intercept#routeHandler-Function) won't be executed and the request will be sent to the origin server without any modifications.
965+
An intercept with a [`StaticResponse`](/api/commands/intercept#staticResponse-StaticResponse) does not have this limitation and will still be executed.
966+
967+
> **Warning: Cookies may not have been applied to synchronous XHR request: http://example.com.**
968+
969+
Cypress is unable to apply cookies to a synchronous XHR request if the request is cross-origin to the `top` origin.
970+
971+
> **Warning: Cookies may not have been set for synchronous XHR response: http://example.com.**
972+
973+
Cypress is unable to set cookies for a synchronous XHR response if the request is cross-origin to the `top` origin.
974+
949975
## Browser Errors
950976

951977
{/* keep old hash */}

0 commit comments

Comments
 (0)