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 /apps/{app}/routes is not returning HTTP 409 in case of existing similar route #254

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

Comments

@denismakogon
Copy link
Contributor

HTTP POST to /apps/{app}/routes is not returning HTTP 409 in case of existing similar route. Similar to #253 but for routes.

Steps to reproduce:

  1. Create app

  2. Create route

curl -H "Content-Type: application/json" -X POST -d '{
    "route": {
        "type": "sync",
        "path":"/hello-sync",
        "image":"iron/hello"
    }
}' http://localhost:10501/v1/apps/myapp/routes

Response:

{"message":"Route successfully created","route":{"appname":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}}
  1. Repeat [2]

  2. List app routes

{"message":"Sucessfully listed routes","routes":[{"appname":"myapp","path":"/hello-sync","image":"iron/hello","memory":128,"type":"sync","config":null}]}

As it can be observed, for 2 HTTP POST request with exact the same data only one route was created.

@ucirello ucirello added this to the Alpha 1 milestone Nov 9, 2016
@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