Add GET support to NetworkInterface
See original GitHub issueI have an application where the ReactJS app is hosted on one domain, and the Django service (using Graphene) is hosted on another. The ReactJS app needs to access the data in the Django app.
Steps to Reproduce
Since Apollo defaults to using POST for queries, I’m hitting a CSRF issue when trying to access the data. At this time, since these APIs are all read-only, I’m using csrf_exempt
on the GraphQLView
and this is working OK.
However, I would much prefer to use GET
for my read requests.
After some digging, I found that I could modify the method to GET by using applyMiddleware
and modifying req.options.method = "GET"
. However, It is still trying to post a BODY, which is not allowed in a GET. I tried doing delete req.request.query
but that didn’t seem to help. I didn’t really expect that second part to work, but gave it a shot anyway… 😃
Expected Behavior
Would you be able to either provide an additional NetworkInterface
that uses GET or some documentation on how to create our own?
Version
- apollo-client@1.0.2
- react-apollo@1.0.1
Note:
This issue was originally posted on react-apollo
but closed because it really belongs here.
https://github.com/apollographql/react-apollo/issues/624#issuecomment-293742620
I may create a PR for this feature at some point, if I get the bandwidth.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top GitHub Comments
I implemented such a network interface in an application a few days ago: https://gist.github.com/n1ru4l/cb24401592417bda7fad989d416f0b9f
This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Apollo Client!