WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 14 months 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
Milestone: 5.0 Priority: normal
Severity: normal Version: 4.9
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:
PR Number:

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 2 years ago.

Download all attachments as: .zip

Change History (8)

@shooper
2 years ago

#1 @shooper
2 years ago

  • Keywords has-patch has-unit-tests added

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


2 years ago

#3 @rachelbaker
2 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to 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
2 years ago

  • Milestone changed from Awaiting Review to 5.0

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


2 years ago

#6 @SergeyBiryukov
14 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

[42354] should be backported to the 5.0 branch.

#7 @danielbachhuber
14 months ago

  • Resolution set to fixed
  • Status changed from reopened to 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.