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

Response code for POST method should be 201 not 200 #788

Closed
3 tasks
jannyHou opened this issue Dec 11, 2017 · 27 comments
Closed
3 tasks

Response code for POST method should be 201 not 200 #788

jannyHou opened this issue Dec 11, 2017 · 27 comments
Labels
feature help wanted REST Issues related to @loopback/rest package and REST transport in general stale

Comments

@jannyHou
Copy link
Contributor

jannyHou commented Dec 11, 2017

Response code for POST method should be 201 not 200

An old issue from LoopBack3: strongloop/loopback#360

We should fix it in LoopBack4 as well.

Notes from the spike

Acceptance criteria

  • Modify controllers in the example/* projects so that create* methods (typically mapped to POST verb) return 201 Created instead of `200.
    • Update the OpenAPI Spec description of operation result, replace 200 to 201
    • Update the controller method implementation to return status code 201 and set Location header to the URL where the newly created model instance can be found
  • Update CRUD Controller template used by CLI similarly
  • If Extension: CrudRestController #2736 has been done, then update the extension accordingly too.
@Cooker-Monster
Copy link

Thanks to reactivate this important point !

@bajtos
Copy link
Member

bajtos commented Dec 12, 2017

I think this has two parts:

@jannyHou
Copy link
Contributor Author

hi team, we are upgrading from swagger2 to openapi3, PR is ready for it #916
There is an interface change of the responseObject in openapi3, I think it's better to implement this story for v3 directly instead of implement it with v2 then take another effort to upgrade to v3, thanks!

@kjdelisle
Copy link
Contributor

Does the alteration to the responseObject formatting change the logic required to handle the return code in some way? I would've expected that the sequence would simply handle the success of a POST with a 201 code in the same way for v2 and v3; that is, I'd expect a property with the same name (probably statusCode) at the top level.

@jannyHou
Copy link
Contributor Author

@kjdelisle good point, honestly I am not sure, and due to the effort needed in v2-v3, see comment:#753 (comment), the PR won't be landed in a few days, so no sense to block this story :)

@bajtos bajtos added Core-GA and removed MVP labels Feb 1, 2018
@bajtos
Copy link
Member

bajtos commented Feb 1, 2018

@kjdelisle and me decided this does not really belong to MVP/Walking Skeleton.

@Cooker-Monster
Copy link

Cooker-Monster commented Feb 1, 2018

So, can you give a status of this issue please ? can we expect a fix on 4.x ?
whatever the version of Open Api specification, have a correct code for POST still make sense ;-)
But I'm not at the right position to mesure the effort... so it's easy to ask !

@shimks shimks removed their assignment Feb 1, 2018
@kjdelisle
Copy link
Contributor

Marking the item as non-MVP doesn't mean that we won't be doing it for the 4.x release, it just means that it's not a part of our initial push to get the framework into a stable state.

Our goal with the idea of MVP is that we want the framework to be in a position where:

  • Community members can begin learning how it works in earnest
  • Community members can begin to contribute fixes, as well as new features or plugins

The MVP is not the final release! It's an interim state between the constant flux of alpha and the near-completeness of a beta. We've set this goal to help stop us from getting too far ahead of ourselves with respect to what we want to see in the final release vs. what should be there at a minimum.

@Cooker-Monster
Copy link

Ok fine ! thx

@Cooker-Monster
Copy link

Hi, any news on this topic please ?

@jannyHou
Copy link
Contributor Author

jannyHou commented Mar 5, 2018

@Cooker-Monster checking with my team, will let you know the update then.

@dhmlau
Copy link
Member

dhmlau commented Mar 19, 2018

@jannyHou , you've mentioned that this is related to the openapi-v3 work that you're doing. Could you please add more details? Thanks.

@dhmlau dhmlau removed DP3 labels Jun 12, 2018
@dhmlau
Copy link
Member

dhmlau commented Jul 23, 2018

Seems to be a duplicate of #436.

@bajtos
Copy link
Member

bajtos commented Jul 30, 2018

Definitely not a duplicate. We may need #436 to be implemented first before we can return 201 with a Location header.

I am removing this story from GA and moving it to [EPIC] REST layer improvements (post-GA) #1452

@stale
Copy link

stale bot commented Jun 20, 2020

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Jun 20, 2020
@lajosf
Copy link

lajosf commented Jul 16, 2020

Dear @bajtos , as I can see the "stale bot" gonna close this thread, because there is no activity. As I can see it is still a problem, not solved yet and may effect more developers.

@stale stale bot removed the stale label Jul 16, 2020
@bajtos
Copy link
Member

bajtos commented Jul 16, 2020

@lajosf I am afraid we don't have enough bandwidth to implement this feature soon. Would you like to contribute it yourself?

@lajosf
Copy link

lajosf commented Jul 16, 2020

Dear Bajtos,
Thank you for the quick answer! After I wrote the above comment I made workaround and works fine.
I have no option to contribute, but thank you (one half of my life is reserved by the company, the other is by my family :))!

@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Jul 14, 2021
@stale
Copy link

stale bot commented Aug 13, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted REST Issues related to @loopback/rest package and REST transport in general stale
Projects
None yet
Development

No branches or pull requests

8 participants