There is inconsistency between AFSuccess and AFFailure on the response .. of course I understand it is not the same .. but when dealing with REST API we expecting to get sometimes status response like 301 or 422... the problem it is the AFFailure return the content in a new object content.body .. when trying to do some check stuff, we xill need a lot of change in ours code to change response.content to `response.content.body'
I added a new objet 'failureinstead ofcontent` and keeping content he same as AFSuccess.
let failure: any = {
body: content,
description: error.description,
reason: error.localizedDescription,
url: error.userInfo.objectForKey('NSErrorFailingURLKey').description
};
resolve({task, content, reason, failure: failure});
Hi @EddyVerbruggen
There is inconsistency between
AFSuccess
andAFFailure
on the response .. of course I understand it is not the same .. but when dealing withREST API
we expecting to get sometimes status response like301
or422
... the problem it is theAFFailure
return the content in a new objectcontent.body
.. when trying to do some check stuff, we xill need a lot of change in ours code to changeresponse.content
to `response.content.body'I added a new objet 'failure
instead of
content` and keeping content he same as AFSuccess.