Skip to content

Allow POST success status codes besides 201 (CREATED)#1254

Merged
djones6 merged 3 commits intoKitura:masterfrom
c1ira:master
May 1, 2018
Merged

Allow POST success status codes besides 201 (CREATED)#1254
djones6 merged 3 commits intoKitura:masterfrom
c1ira:master

Conversation

@c1ira
Copy link
Copy Markdown
Contributor

@c1ira c1ira commented Apr 19, 2018

Description

Allow Kitura to send any success response for a POST, not just CREATED.

This replaces #1218, and there's some discussion there.

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), it's treated as an error.

How Has This Been Tested?

Added unit test testCodablePostSuccessStatuses. And variations on this logic have been in use at Capital One for months.

Checklist:

  • If applicable, I have updated the documentation accordingly.
  • If applicable, I have added tests to cover my changes.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 19, 2018

Codecov Report

Merging #1254 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1254      +/-   ##
==========================================
+ Coverage   89.02%   89.04%   +0.02%     
==========================================
  Files          38       38              
  Lines        2286     2291       +5     
==========================================
+ Hits         2035     2040       +5     
  Misses        251      251
Flag Coverage Δ
#Kitura 89.04% <100%> (+0.02%) ⬆️
Impacted Files Coverage Δ
Sources/Kitura/CodableRouter.swift 79.59% <100%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23d6a0d...c2a7e79. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@djones6 djones6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - thanks for re-working the original PR.

One thing, there is now a third variant of result handler, constructTupleArrayOutResultHandler, which should have the same change applied so that its behaviour is consistent.

Copy link
Copy Markdown
Collaborator

@djones6 djones6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On reflection, let's get this merged and I'll update the remaining handler in another PR.

@djones6 djones6 merged commit 66a8302 into Kitura:master May 1, 2018
djones6 added a commit that referenced this pull request May 1, 2018
djones6 added a commit that referenced this pull request May 1, 2018
and remove a redundant setting of response.status
djones6 added a commit that referenced this pull request May 10, 2018
- and permit `nil` Codable responses when a default or custom success status is returned (building on #1254)
djones6 added a commit that referenced this pull request May 30, 2018
- and permit `nil` Codable responses when a default or custom success status is returned (building on #1254)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants