Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#42781 closed defect (bug) (fixed)

HTTP Status code should be a 400 instead of a 409 when attempting to add a term (by slug) that already exist

Reported by: shooper Owned by: rachelbaker
Priority: normal Milestone: 5.0
Component: REST API Version: 4.9
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: rest-api

Description

The patch to address #41370, which released in WP 4.9 changed the HTTP status code returned when a term already exists to 409. It should have been an HTTP 400 for consistency with the rest of the endpoints.

Attachments (1)

42781.diff​ (1.5 KB ) - added by shooper 9 years ago.

Download all attachments as: .zip

Change History (8)

@shooper
9 years ago

#1 @shooper
9 years ago

  • Keywords has-patch has-unit-tests added

This ticket was mentioned in ​Slack in #core-restapi by shooper. ​View the logs.


9 years ago

#3 @rachelbaker
9 years ago

  • Owner set to rachelbaker
  • Resolution → fixed
  • Status new → closed

In 42354:

REST API: Correct HTTP status code in error for requests to create a duplicate term.

The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Fixes #42781. See #41370.

#4 @netweb
9 years ago

  • Milestone Awaiting Review → 5.0

This ticket was mentioned in ​Slack in #core-restapi by kadamwhite. ​View the logs.


9 years ago

#6 @SergeyBiryukov
8 years ago

  • Resolution fixed
  • Status closed → reopened

[42354] should be backported to the 5.0 branch.

#7 @danielbachhuber
8 years ago

  • Resolution → fixed
  • Status reopened → closed

In 43756:

REST API: Correct HTTP status code in error for requests to create a duplicate term.

The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Merges [42354] to the 5.0 branch.
Fixes #42781. See #41370.

Note: See TracTickets for help on using tickets.