Opened 6 years ago
Last modified 2 years ago
#18057 assigned defect
xhr.del (dojo/request/xhr) doesn't automatically handle json response
Reported by: | xgendrea | Owned by: | dylan |
---|---|---|---|
Priority: | undecided | Milestone: | 1.14 |
Component: | IO | Version: | 1.9.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Hi all,
When I use this code for example:
xhr.del( url+'/'+id, { handleAs : "json", headers : { "Accept": "application/javascript, application/json" } } ).then( function (data) { var rowId = json.parse(data)[0].id; // why json.parse is needed !!!! } );
I need to use json.parse because data is a string.
This is different as in xhr.get or xhr.put because response data in those cases are automatically parsed.
For my point of view, as handleAs is set to 'json', the automatic parsing functionnality must be made in xhr.del.
Thx for your answer
Change History (3)
comment:1 Changed 4 years ago by
Milestone: | tbd → 1.8.11 |
---|---|
Owner: | set to dylan |
Status: | new → assigned |
comment:2 Changed 4 years ago by
Milestone: | 1.8.11 → 1.12 |
---|
comment:3 Changed 2 years ago by
Milestone: | 1.13 → 1.14 |
---|
Note: See
TracTickets for help on using
tickets.
The reason this is not supported is that delete was not expected to have a payload for you to handle/parse. That said, the spec says otherwise, https://stackoverflow.com/questions/6581285/is-a-response-body-allowed-for-a-http-delete-request .
Will look at this for 1.12.