Closed Dbigshooter closed 7 years ago
The key __response_statusCode will be added when the http status code is 200 or higher. AlamofireJsonToObjects will still try to parse the object because some systems will also return an error object in json format.
You can choose to include the error fields inside your object (or in a base class) or you could use the getSpecificType function to get an error object.
The question is why you are getting a status code >= 200
But it shouldn't be a problem to get a 200 status code? I see no errors with me calls what so ever?
You are right. It should be > 200. I have changed the code that if its 200 you won't get __response_statusCode
I still see the same outcome? I get status code 200 on all my requests. Have you pushed it to cocoapods?
2.3.1 is the latest release both in Cocoapods as in GitHub.
As a test I just downloaded the latest release from https://github.com/evermeer/AlamofireJsonToObjects/releases
When I look at AlamofireJsonToObjects.swif I see this check twice: if response?.statusCode ?? 0 > 200 {
So If you do have that update, it should only get the __response_statusCode if the statusCode is above 200
So do you have the same code? If not, then why is it not updated to the latest version? If you do have the code, then your status code should be above 200. Or am I missing something else?
I imagine you should do the check on >= 300, since status codes in the 200 range is just fine. 201 = created, 202 = accepted and so on.
When I updated my repo I just got version 2.2.0 from cocoapods? Does the new version require the beta of new release of cocoapods?
I don't know why you would get the old version... Could it be because of the supported OS version? Since Swift 3 it should be iOS 8 and up. I will change the status check to >= 300
Wow, my bad. I had the library in the pod set to a specific branch, my apologies.
no worries 😎
I just pushed a new version (2.4.0) with better support for handling HTTP error statuses.
It's explained in the readme. For a unit test demonstrating this, see: https://github.com/evermeer/AlamofireJsonToObjects/blob/master/AlamofireJsonToObjectsTests/AlamofireJsonToObjectsTests.swift#L81
Just updated EVReflection and this lib, and all my classes says this, what is that?