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

Handle status codes as JSONResponse #6520

Closed
wants to merge 4 commits into from
Closed

Conversation

malhotra5
Copy link
Contributor

@malhotra5 malhotra5 commented Jan 29, 2025

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

We want to build a middleware that can refresh the token when a Github API hits 401 errors;

Currently, we're using a mix of raise_for_status() vs JSONResponse (with status code). This PR standardizes the error responses to use JSONResponse so that we

  • always have a response object in the middleware
  • don't have to handle different types of error code exceptions

Link of any specific issues this addresses


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:6f89e44-nikolaik   --name openhands-app-6f89e44   docker.all-hands.dev/all-hands-ai/openhands:6f89e44

Sorry, something went wrong.

@malhotra5 malhotra5 marked this pull request as draft January 29, 2025 18:08
@malhotra5 malhotra5 marked this pull request as ready for review January 29, 2025 21:42
@malhotra5 malhotra5 changed the title Change auth route prefix Handle status codes as JSONResponse Jan 29, 2025
@malhotra5 malhotra5 marked this pull request as draft January 31, 2025 20:15
@malhotra5 malhotra5 closed this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant