1

Does Foundation (or other 1st party framework) have enum/constants for the NSHTTPURLResponse HTTP statusCode values? For example, something like:

NSInteger kHTTPStatusCodeForbidden = 403;

Searched through the docs, but couldn't find anything.

ospr
  • 1,650
  • 2
  • 17
  • 21
  • You can have specific error code for your own specific reason. You can add more error codes depending upon your requirement. So there is no standard enum/constants for these. You can create your own. – gagarwal Nov 25 '14 at 23:35
  • I guess I'm looking for constants for the standard error codes as defined here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. Does the HTTP protocol not require that the codes defined above always reflect the definitions in rfc2616? – ospr Nov 26 '14 at 00:34
  • You can still override it. The web service I use often return "404" when something goes wrong and JSON response having an additional error code and status. – gagarwal Nov 26 '14 at 00:39
  • Got it, thanks. So I guess the answer is no, there are no constants/enums? :) – ospr Nov 26 '14 at 01:14
  • ospr: (a) RFC 2616 is obsolete. (b) The set of HTTP method names is extensible, thus enums make little sense. What's relevant is the IANA registry: http://www.iana.org/assignments/http-methods/http-methods.xhtml – Julian Reschke Nov 26 '14 at 07:19

0 Answers0