I am working on an iOS project.
In this application, I am downloading images from the server.
Problem:
While downloading images I a
Sometimes Browser respond to http error handler with Error Object, that have status set to 0, even if you can see 404, 401, 500 etc. error status in network.
This could happen if your Application and API are on different domains - CORS mechanism is applied. According to CORS for each API request browser sends two requests:
In Application we are handling Error response for "Actual/Origin request", and if "preflight OPTIONS request" failed - browser doesn't give correct HttpError object for http error handler. So to get correct status of http response - be sure to get success preflight OPTIONS request response.