Opened 12 years ago
Closed 12 years ago
#8228 closed defect (fixed)
[patch][ccla]IE7: dojox.json.Rest range is undefined, causes exception
Reported by: | Adam Peller | Owned by: | Dustin Machi |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | RPC | Version: | 1.2.2 |
Keywords: | Cc: | [email protected]…, Kris Zyp | |
Blocked By: | Blocking: |
Description
This comes from Hernan Badenes (IBM, CCLA)
In dojox.json.Rest, a request object is created that is later used to build a XHR object. These arguments object contains the headers that will be sent in the HTTP GET (or POST, or ...): "Accept" and "Range". When querying for an individual object, the Range is assigned the value undefined. This throws an exception "Invalid procedure call or argument" in Internet Explorer (I tested IE7). (The exact place is in dojo._base.xhr, line 664, "xhr.setRequestHeader(hdr, args.headers[hdr]);")
The problem is that IE7 does not accept to setRequestHeader(propName, undefined). To avoid this, I think that dojox.rpc.Rest should not set that Range===undefined, but just skip it from the parameters when not using it.
Attached is a testcase that exposes this problem by just doing:
var store = new dojox.data.JsonRestStore?({ target: "/foo" }); store.byId({ identity: "42" });
this should perform a GET and likely yield in a http 404. But in IE7 it throws an exception. The code to patch is in Rest.js:
function(id, args){ |
return {
(...) headers: {
(...)
Range: args && (args.start >= 0 args.count >= 0) ? "items=" + (args.start '0') + '-'
+ ((args.count && (args.count + (args.start
}
};
};
that "Range" property should be avoided. A proposed patch is attached as well.
Attachments (2)
Change History (6)
Changed 12 years ago by
comment:1 Changed 12 years ago by
Cc: | [email protected]… Kris Zyp added |
---|
comment:2 Changed 12 years ago by
Summary: | IE7: dojox.json.Rest range is undefined, causes exception → [patch][ccla]IE7: dojox.json.Rest range is undefined, causes exception |
---|
comment:3 Changed 12 years ago by
Milestone: | tbd → 1.3 |
---|
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
don't set Range in headers unless it's going to be defined