Storing/retrieving the method/URL of the previous request. #2399

Closed
wants to merge 4 commits into
from

Projects

None yet

3 participants

@arian
Member
arian commented Aug 13, 2012

👍

@ibolmo ibolmo commented on the diff Aug 13, 2012
Source/Request/Request.js
@@ -196,7 +209,7 @@ var Request = this.Request = new Class({
xhr.onprogress = this.progress.bind(this);
}
- xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
+ xhr.open(upperMethod, url, this.options.async, this.options.user, this.options.password);
@ibolmo
ibolmo Aug 13, 2012 MooTools member
this.method = method.toUpperCase();
this.url = url;

// ...

xhr.open(this.method, url, // ...
@ibolmo ibolmo commented on the diff Aug 13, 2012
Docs/Request/Request.md
@@ -248,6 +248,46 @@ Returns the given response header or null if not found.
alert(this.getHeader('Date')); // alerts the server date (for example, 'Thu, 26 Feb 2009 20:26:06 GMT')
}});
+Request Method: getUrl {#Request:getUrl}
@ibolmo
ibolmo Aug 13, 2012 MooTools member

Instead of getUrl it should be getURL since it's Uniform Resource Locator

...

Then again I haven't checked other methods with acronyms for usage. @arian do you recall?

@arian
arian Aug 13, 2012 MooTools member

agreed, will check if we do this consistently.

@arian
arian Aug 13, 2012 MooTools member

we do with String.uniqueID, DOMEvent, Fx.CSS, .. , but not really with [...].hexToRgb. So I would say we usually do this.

@ibolmo
ibolmo Aug 13, 2012 MooTools member

Thanks @arian for the research. @chrispitt just update the PR, and fix the small optimization and LGTM.

@ibolmo
Member
ibolmo commented Aug 13, 2012

Sorry I just thought of a little UX problem:

var request = new Request({ url: '#' });
request.getURL(); // null <-- oops!
@assertchris

The docs clearly state that those methods return data from the last request, not from option state.

@arian
Member
arian commented Aug 13, 2012

I think it should return what's passed in xhr.open.

@arian
Member
arian commented Aug 13, 2012

but looking at the code that happens.. (except with GET data stuff)

@ibolmo ibolmo modified the milestone: 1.6, 1.5 Mar 3, 2014
@ibolmo ibolmo added the enhancement label Mar 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment