Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

HTTP POST to /app for app creation should return HTTP 409 if app already exists #253

Closed
denismakogon opened this issue Nov 9, 2016 · 1 comment
Assignees
Milestone

Comments

@denismakogon
Copy link
Contributor

HTTP POST to /app for app creation should return HTTP 409 if app already exists, but API service wouldn't do anything rather than accepting request and returning HTTP 200

Steps to reproduce:

  1. Create app
curl -H "Content-Type: application/json" -X POST -d '{
    "app": { "name":"myapp" }
}' http://localhost:10501/v1/apps

Response:

{"message":"App successfully created","app":{"name":"myapp","config":null}}
  1. Repeat [1]

Response:

{"message":"App successfully created","app":{"name":"myapp","config":null}}

In HTTP v1.1 such case mentioned as HTTP Conflict and server should return corresponding status code HTTP 409.

@ucirello
Copy link
Contributor

ucirello commented Nov 9, 2016

I really dispute that 409 is the correct response. First, 4xx are client errors - this is clearly a server-side issue; secondly, assuming that 4xx is the correct error class (which I give in for discussion purposes), I also do not believe 409 is the correct answer. 409 Conflict is to reveal a concurrency problem in competing updates. In this case, we are trying to block a request that shouldn't have taken place anyway - meaning that 400 Bad Request would be a more appropriate response in my opinion.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants