Skip to content

Ajax: Add the responseURL field to jqXHR#5826

Merged
mgol merged 1 commit into
jquery:mainfrom
mgol:jqxhr-responseURL
May 16, 2026
Merged

Ajax: Add the responseURL field to jqXHR#5826
mgol merged 1 commit into
jquery:mainfrom
mgol:jqxhr-responseURL

Conversation

@mgol
Copy link
Copy Markdown
Member

@mgol mgol commented Apr 21, 2026

Summary

Expose xhr.responseURL (the final URL after redirects, including any redirects followed by the browser) as jqXHR.responseURL. The XHR transport passes it through the object-form completeCallback introduced in gh-4634, so the positional signature stays untouched.

Following the existing responseText/responseXML/responseJSON pattern, jqXHR.responseURL is only set when a transport reports it. As a result:

  • modern-browser XHR: the final URL string
  • IE 11 XHR: undefined (no native support)
  • script / JSONP / aborted requests: undefined (transport has no way to know the URL)

A reusable redirect mock action has been added to both the Node middleware and mock.php so the redirect path can be exercised.

Fixes gh-4339
Ref gh-4634
Ref gh-5793

Checklist

Expose `xhr.responseURL` (the final URL after redirects, including any
redirects followed by the browser) as `jqXHR.responseURL`. The XHR
transport passes it through the object-form `completeCallback`
introduced in jquerygh-4634, so the positional signature stays untouched.

Following the existing `responseText`/`responseXML`/`responseJSON`
pattern, `jqXHR.responseURL` is only set when a transport reports it.
As a result:

* modern-browser XHR: the final URL string
* IE 11 XHR: `undefined` (no native support)
* script / JSONP / aborted requests: `undefined` (transport has no
  way to know the URL)

A reusable `redirect` mock action has been added to both the Node
middleware and `mock.php` so the redirect path can be exercised.

Fixes jquerygh-4339
Ref jquerygh-4634
Ref jquerygh-5793
@mgol mgol self-assigned this Apr 21, 2026
@mgol mgol requested a review from timmywil April 21, 2026 21:05
@mgol mgol added the Ajax label Apr 21, 2026
@mgol mgol added this to the 4.1.0 milestone Apr 21, 2026
@mgol mgol requested a review from gibson042 April 21, 2026 21:06
@mgol mgol added the Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. label Apr 22, 2026
Copy link
Copy Markdown
Member

@timmywil timmywil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timmywil timmywil removed the Discuss in Meeting Reserved for Issues and PRs that anyone would like to discuss in the weekly meeting. label May 11, 2026
@mgol mgol removed the Needs review label May 16, 2026
@mgol mgol merged commit 5691e03 into jquery:main May 16, 2026
16 checks passed
@mgol mgol deleted the jqxhr-responseURL branch May 16, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Adding responseURL field to jqXHR

3 participants