Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Creating a term should return 201 #1751

Description

@danwatt

Im using the API to create some terms (POST /wp-json/wp/v2/terms/...), and I noticed it returns 200, while other endpoints (such as creating a post) return the correct 201/CREATED.

From test-rest-terms-controller.php:

    public function test_create_item() {
        wp_set_current_user( $this->administrator );
        $request = new WP_REST_Request( 'POST', '/wp/v2/terms/category' );
        $request->set_param( 'name', 'My Awesome Term' );
        $request->set_param( 'description', 'This term is so awesome.' );
        $request->set_param( 'slug', 'so-awesome' );
        $response = $this->server->dispatch( $request );
        $this->assertEquals( 200, $response->get_status() ); // <----- wrong status code
        $data = $response->get_data();
        $this->assertEquals( 'My Awesome Term', $data['name'] );
        $this->assertEquals( 'This term is so awesome.', $data['description'] );
        $this->assertEquals( 'so-awesome', $data['slug'] );
    }

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions