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
Use proper 2xx HTTP codes on connect #334
Comments
Agreed. I think we should also return a location header with the location of the newly created resource. Arguably, if we already know the |
IMO on the 201/200 I'm not sure I see a reason yet why a client would need it, but on the other hand it's good to be communicative if we have that information to hand. |
|
I agree about the post request to a specific endpoint for the known repo ID. |
💯 on the HATEOS thing. Let's do that before we add any more end-points. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions 🙏. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions 🙏. |
bump |
We're working on this code now as part of https://github.com/hiptest/cucumberstudio/issues/1434 I suggest we take the opportunity to clean it up a little. I would starty by changing this line to send a
That can then drive a change to this unit test for the router/controller: https://github.com/SmartBear/git-en-boite/blob/main/packages/web/src/routes/repos/update.spec.ts#L30 It should be changed to behave more like this endpoint, so that it creates the repo. It should also be changed to update the repo if it already exists, with the new https://github.com/SmartBear/git-en-boite/blob/main/packages/web/src/routes/repos/create.spec.ts#L41 We can be confident about changing the |
Do you mean the new |
Yes! I've updated the comment for clarity. |
@jbpros I think this is done in 57aaa63. I kept the It now returns a 201 created. The redirect stuff is gone. WDYT? |
We currently use a redirect (
30x
) HTTP status code on a connect request for a repo that was already connected. I believe this is an odd use of a redirect status. The 3xx (Redirection) class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. In the case of a connect request on git-en-boîte for an already connected repo, the client is not expected to take any further action to connect the repo.I'm unclear as to why we need to tell the client about the internal differences: does it matter if the repo was already connected or not?
If it does, then I suggest we use
201 Created
as the status for a connect that succeeded and actually connected a new repo,200 OK
for a successful connect for an existing repo.If it does not matter, then we just return
200 OK
on all successful connects (this has my preference for now, but I might be missing a good reason for the differentiation).We'll need to adapt
Git::GitEnBoite
in CucumberStudio when we make this change.Checklist:
Git::GitEnBoite.connect
/repos/:repoId
The text was updated successfully, but these errors were encountered: