Skip to content

Networking — 0.15.0

Compare
Choose a tag to compare
@3lvis 3lvis released this 20 Jan 11:20
· 579 commits to master since this release
  • Stubbing failures: Now you can provide a status code when stubbing endpoint calls, if the status code is 2XX the response object will be returned, otherwise we will return an NSError containing the status code and a proper description.
  • NetworkingStatusCodeType: 0.15.0 introduces a new and nicer way to categorize status codes, now you can use the statusCodeType() method in any Int, it will return any of the following cases:
/**
 Categorizes a status code.
 - `Informational`: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.
 - `Successful`: This class of status code indicates that the client's request was successfully received, understood, and accepted.
 - `Redirection`: This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request.
 - `ClientError:` The 4xx class of status code is intended for cases in which the client seems to have erred.
 - `ServerError:` Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request.
 - `Unknown:` This response status code could be used by Foundation for other types of states, for example when a request gets cancelled you will receive status code -999
 */
public enum NetworkingStatusCodeType {
    case Informational, Successful, Redirection, ClientError, ServerError, Unknown
}