#17638 closed defect (wontfix)
promises chaining is not maintaining promises extra properties
Reported by: | cjolif | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Core | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dojo/request reflects "metadata" properties for a response by augmenting the returned promise with a "response" property. (see http://dojotoolkit.org/reference-guide/1.9/dojo/request.html)
This is particularly apparent when using dojo/request/xhr, where response headers, etc. are included in this "response" property.
When this promise is chained, the extra properties are lost, see: http://jsfiddle.net/2cqpL/1/
This is starts to be a real problem when we're trying to execute more complex behaviour. It seems the chaining behaviour of .then() should be including these extra properties.
Note: See
TracTickets for help on using
tickets.
Thanks for the report, but this is not a bug. The
response
property is exceptional anddojo/request
goes out of its way to make it exist. Copying properties from promises to other promises is wasteful and slow and there is no reason in reality why you should ever need this. If you need the response object in your callbacks it’s your responsibility to pass that data to the callbacks.Also, making a change like this would not align with the official Web standard Promises specification, which we should working toward aligning with, not going against.