Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !4316

Closed
Created Jun 14, 2013 by Administrator@rootOwner
  • Report abuse
Report abuse

WIP: Respond with 409 when resources conflict

  • Overview 13
  • Commits 1
  • Changes 2

Created by: dblessing

** Work in progress ** Seeking feedback

Per the API docs, a 409 response should be sent when resources conflict. Right now only one part of the API actually implements this functionality (teams I believe). I believe we should make this work across the API where applicable. This is my first crack at a solution. I am seeking feedback on whether you feel this is a viable solution. If so, I will implement across the API.

Steps to reproduce: Using the API, attempt to create a project with a name or path that already exists.

Expected behavior: This should result in a 409 conflict response.

Observed behavior: A 404 not found response is received.

Errors that arise from conflicting resources are actually sent by ActiveRecord. It sends a hash that looks something like { 'name' => 'has already been taken' } or { 'path' => 'has already been taken' }. So if we check the value for 'has already been taken' we know there's a resource conflict. Then, the key of the has (like 'name') represents what attribute the error is for. Documentation for ActiveRecord validations is at http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html

Thanks for your feedback.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/dblessing/409