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

Exception handling with status code . As graphql-strawberry always return status code as 200 OK. #2813

Closed
3 tasks
itsckguru opened this issue Jun 6, 2023 · 1 comment

Comments

@itsckguru
Copy link

itsckguru commented Jun 6, 2023

Feature Request Type

  • Core functionality
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

def default_resolver(root, field):
"""resolver"""
try:
return operator.getitem(root, field)
except KeyError:
return getattr(root, field)

config = StrawberryConfig(
default_resolver=default_resolver
)

schema = strawberry.Schema(query=Query,config=config)
graphql_app = GraphQLRouter(schema, graphiql = env!='production')

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@DoctorJohn
Copy link
Member

The reason Strawberry almost always returns 200 OK is because that's part of the GraphQL specification. Following the specification is important to stay compatible with standard GraphQL clients and tools.

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

No branches or pull requests

2 participants