Opened 5 years ago

Last modified 20 months 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 3 years ago by dylan

Milestone: tbd1.8.11
Owner: set to dylan
Status: newassigned

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.

comment:2 Changed 3 years ago by dylan

Milestone: 1.8.111.12

comment:3 Changed 20 months ago by dylan

Milestone: 1.131.14
Note: See TracTickets for help on using tickets.