New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve data on get without dependency on server header #146
Conversation
This way test is more accurate and when it fails you can see why.
a.href = url | ||
return a.href | ||
} | ||
options.requestUrl = qualifyURL(settings.url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theres a parseURL
helper already. parseURL(settings.url).href
should work.
I think we should avoid setting requestUrl
on options
, maybe just make a new local for it.
Otherwise, I dig it. |
@@ -165,6 +165,8 @@ var pjax = $.pjax = function( options ) { | |||
|
|||
if (!fire('pjax:beforeSend', [xhr, settings])) | |||
return false | |||
|
|||
pjax.requestUrl = parseURL(settings.url).href |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just a local? var requestUrl
inside the pjax
function scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it used outside the pjax function scope:
function extractContainer(data, xhr, options) {
var obj = {}
// Prefer X-PJAX-URL header if it was set, otherwise fallback to
// using the original requested url.
obj.url = stripPjaxParam(xhr.getResponseHeader('X-PJAX-URL') || pjax.requestUrl)
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry its hard to tell from the diff. I guess the original way assigning it to options make sense then. Sorry for the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. I changed it back.
Not sure what you mean by local. I moved the requestUrl property from options to pjax, is that what you ment? |
Just a local variable: Yeah, just keep pushing to the same branch. No need for another pull. |
Preserve data on get without dependency on server header
When server doesn't return url in X-PJAX-URL header many tests fail. Mainly due to data parameters not being added to url on GET requests.
This fixes all but redirection and reduces dependency on the response header.