Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement!: create should send 201 status code #19869

Merged
merged 28 commits into from Apr 15, 2024

Conversation

innerdvations
Copy link
Contributor

@innerdvations innerdvations commented Mar 21, 2024

What does it do?

All create methods throughout strapi now use ctx.created, most importantly the content api. In cases I wasn't sure it was safe to use ctx.created I explicitly set status to 201

Why is it needed?

Create actions should result in a 201 http status code

How to test it?

All the updated tests test it pretty thoroughly.

But to test manually, the default status for a create action in a custom controller should be 201 so:

  • create a content type
  • use the content API to create an item of that content type
  • the response status code should be 201
  • ensure that update/delete/etc actions are all still 200 status

Admin API can essentially be tested the same way, just through different endpoints.

Related issue(s)/PR(s)

DX-1118

@innerdvations innerdvations self-assigned this Mar 21, 2024
@innerdvations innerdvations changed the title enhancement: log when server restarts enhancement: create should send 201 status code Mar 21, 2024
Copy link

vercel bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 11:08am

@innerdvations innerdvations changed the title enhancement: create should send 201 status code fix: create should send 201 status code Mar 21, 2024
@innerdvations innerdvations added source: core:strapi Source is core/strapi package pr: fix This PR is fixing a bug labels Mar 21, 2024
@innerdvations innerdvations changed the title fix: create should send 201 status code fix!: create should send 201 status code Apr 12, 2024
@innerdvations innerdvations added the flag: 💥 Breaking change This PR contains breaking changes and should not be merged label Apr 12, 2024
@innerdvations innerdvations changed the title fix!: create should send 201 status code enhancement!: create should send 201 status code Apr 12, 2024
@innerdvations innerdvations added pr: enhancement This PR adds or updates some part of the codebase or features and removed pr: fix This PR is fixing a bug labels Apr 12, 2024
@innerdvations innerdvations merged commit 1801975 into v5/main Apr 15, 2024
86 of 91 checks passed
@innerdvations innerdvations deleted the fix/create-status-201 branch April 15, 2024 12:03
@echoes-hq echoes-hq bot added the echoes/type: feature/enhancement For enhancements to existing functionality and tools label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes/type: feature/enhancement For enhancements to existing functionality and tools flag: 💥 Breaking change This PR contains breaking changes and should not be merged pr: enhancement This PR adds or updates some part of the codebase or features source: core:strapi Source is core/strapi package
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants