Opened 8 years ago
Closed 7 years ago
#17323 closed defect (wontfix)
dojo/request/xhr methods ignore returnDeferred argument
Reported by: | Stefan Bird | Owned by: | Bryan Forbes |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | IO | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dojo/request/util.addCommonMethods() only passes on the first two arguments to the provider function, meaning that the returnDeferred argument isn't available when calling xhr.get()/xhr.post() etc. This argument is important as it's the only way to access the headers sent back by the server. This issue can be fixed by changing the function to
exports.addCommonMethods = function addCommonMethods(provider, methods){ array.forEach(methods||['GET', 'POST', 'PUT', 'DELETE'], function(method){ provider[(method === 'DELETE' ? 'DEL' : method).toLowerCase()] = function(url, options){ arguments[1] = lang.delegate(options, {method: method}); return provider.apply(this, arguments); }; }); };
Change History (2)
comment:1 Changed 8 years ago by
Component: | General → IO |
---|---|
Owner: | set to Bryan Forbes |
comment:2 Changed 7 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
The
returnDeferred
argument is only there for the backwards compatible APIs likedojo/_base/xhr
. To get response headers usingdojo/request
, use theresponse
property of the returned promise: