-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow POST success status codes besides 201 (CREATED) #240
Conversation
…f one explicitly specifies any other success response, such as 200 (OK), Kitura treats it like an error. This change adds HTTPStatusCode extensions for identifying whether a status code represents success.
Codecov Report
@@ Coverage Diff @@
## master #240 +/- ##
==========================================
- Coverage 74.89% 74.56% -0.33%
==========================================
Files 31 31
Lines 4162 4164 +2
==========================================
- Hits 3117 3105 -12
- Misses 1045 1059 +14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
|
||
extension HTTPStatusCode { | ||
|
||
public static var successRange: Range<HTTPStatusCode> { return .OK ..< .multipleChoices } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems reasonable to define a range on HTTPStatusCode
in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we might consider adding the other ranges while we're at it (1xx informational, 3xx redirection, 4xx clienterror, 5xx servererror)
@c1ira Thanks for the PR. I'm happy to merge this now in order to unblock work on Kitura/Kitura#1218. Ideally we'd have some tests to confirm that |
Thanks, and I'll put the test on my to-do list. |
Allow POST success status codes besides 201 (CREATED)
Description
This change adds HTTPStatusCode extensions for identifying whether a status code represents success. The remainder of the change is PRed to Kitura: Kitura/Kitura#1218
Motivation and Context
When Kitura receives a POST, its success response is 201 (CREATED). If one explicitly specifies any other success response, such as 200 (OK), Kitura treats it like an error.
How Has This Been Tested?
Ran
swift test
.Have been using this modification at Capital One for several months.
Checklist: