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

refactor: make HTTP API returns non-200 status code when execution fails #2888

Closed
killme2008 opened this issue Dec 7, 2023 · 6 comments
Closed
Labels
C-enhancement Category Enhancements C-user-experience Category User Experience good first issue Good for newcomers help wanted Extra attention is needed

Comments

@killme2008
Copy link
Contributor

What type of enhancement is this?

User experience

What does the enhancement do?

The HTTP always returns 200 status code even when the execution fails currently. The failure status is attached in the response content as the code field. It does not comply with RESTful conventions and may confuse.

We'd like to refactor this behavior and return the non-200 status code when the execution fails. But we need to keep returning the code field in the response JSON content.

Implementation challenges

Maybe some test cases should be fixed while doing this refactor.

@killme2008 killme2008 added C-enhancement Category Enhancements good first issue Good for newcomers help wanted Extra attention is needed Size: M C-user-experience Category User Experience labels Dec 7, 2023
@ananta
Copy link

ananta commented Dec 7, 2023

@killme2008 I would love to work on this issue :)

@killme2008
Copy link
Contributor Author

@killme2008 I would love to work on this issue :)

Appreciated. Please take it.

There are some code that you may want to read

All the HTTP API implementation is under:
https://github.com/GreptimeTeam/greptimedb/tree/develop/src/servers/src/http

And the main handler is

https://github.com/GreptimeTeam/greptimedb/blob/develop/src/servers/src/http/handler.rs

The JsonReponse is at

pub struct JsonResponse {

@killme2008
Copy link
Contributor Author

@ananta Just a kind reminder, are u still working on this issue? Happy New Year!

@ananta ananta removed their assignment Jan 2, 2024
@ananta
Copy link

ananta commented Jan 2, 2024

Hey Happy New Year 🎊 @killme2008 !!,

I got caught up with school stuff and couldn't finish the task. I'm going to unassign myself for now, but I'll check back later and see if I can help out if it's still open. Thanks!

@killme2008
Copy link
Contributor Author

Hey Happy New Year 🎊 @killme2008 !!,

I got caught up with school stuff and couldn't finish the task. I'm going to unassign myself for now, but I'll check back later and see if I can help out if it's still open. Thanks!

All right! Welcome back if you are not busy in the future. Thank you.

@tisonkun
Copy link
Collaborator

Closed as resolved in #3473.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements C-user-experience Category User Experience good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants