graphql-python / graphql-python/sanic-graphql
Per-request context
- Ngôn ngữ chính
- Python
- Star
- 148
- Fork
- 17
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
What's the appropriate way to inject values into the context on a per-request basis? That is, I can statically set context values when I add the route, but is there a way to do so dynamically, per-request?
Looking at the code, I guess subclass I can override `GraphQLView.get_context` for that purpose. Is this the only way?
If so, I would suggest a "context_function" argument to `GraphQLView`, which would be a function that takes the request, and the default/current context, and returns a new context. This function would be called as part of `get_context`. This would avoid having to subclass the view only for such a simple(and probably pretty common) customization.
Thanks!
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.