-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# SwiftHTTPStatusCodes | ||
Swift enum wrapper for easier handling of HTTP status codes. | ||
|
||
All the [RF2616](http://www.ietf.org/rfc/rfc2616.txt) standard status codes are supported with a few added ones from the [Wikipedia page](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes). | ||
|
||
## Helper methods | ||
|
||
There are `Bool` properties on the enum for checking if a status code is of a certain category: | ||
```swift | ||
isInformational | ||
isSuccess | ||
isRedirection | ||
isClientError | ||
isServerError | ||
``` | ||
|
||
There is also an extension on `NSHTTPURLResponse` to obtain a status code enum directly and to `init` with one: | ||
```swift | ||
var statusCodeValue: HTTPStatusCode? | ||
init?(URL url: NSURL, statusCode: HTTPStatusCode, HTTPVersion: String?, headerFields: [NSObject : AnyObject]?) | ||
``` |