Open mstrumeck opened 8 months ago
Hey @mstrumeck 👋
Thank you for choosing Robyn 😄 Can you please share your schema
class?
@sansyrox here's a minimal reproduction:
import robyn
import strawberry
app = robyn.Robyn(__file__)
@strawberry.type
class Query:
hello: str = strawberry.field(resolver=lambda: "Hello, world!")
schema = strawberry.Schema(query=Query)
@app.post("/graphql")
async def handle_api_request(request: robyn.Request) -> robyn.jsonify:
import json
# note this
body = json.loads(request.body)
query = str(body["query"])
variables = body.get("variables")
data = await schema.execute(
query,
variables,
)
return robyn.jsonify(
{
"data": (data.data),
**({"errors": data.errors} if data.errors else {}),
**({"extensions": data.extensions} if data.extensions else {}),
}
)
@app.get("/graphql", const=True)
async def handle_api_playground_request(request: robyn.Request):
from strawberry.http.ides import get_graphql_ide_html
return {"description": get_graphql_ide_html(graphql_ide="apollo-sandbox"), "headers": {"Content-Type": "text/html"}}
app.start(port=8080, host="0.0.0.0") # host is optional, defaults to 127.0.0.1
btw using json.loads works, not sure why request.json() doesn't work properly
Thanks @patrick91 , but it is still not working for me
@sansyrox can you show me your cli?
@patrick91 , here you go
Bug Description
Hi! I've decided to use Robyn together with strawberry-graphql but is seems it not working properly. Robyn has a problem with rendering the answer from the standard introspection query. With the following code:
I going to always get the following response:
That's happening always when I trying call http://localhost:8080/graphql with GET
Steps to Reproduce
python=3.12.0, robyn=^0.44.2, uvloop=^0.19.0, strawberry-graphql=^0.212.0
python src.py --dev
http://localhost:8080/graphql
in you browserYour operating system
Linux
Your Python version (
python --version
)3.12
Your Robyn version
latest
Additional Info
No response