Comments (7)
Your problem might be caused by not including credentials: same-origin
in your request header (JakeChampion/fetch#386).
This should now be possible with the release of 1.3.2: #9
Like:
new GraphQLClient(YOUR_ENDPOINT_URL, {
credentials: "same-origin",
});
from graphql-request.
hey @mwld is that actually working for you?
from what i've found isomrophic-fetch will just ignore cookies (or set-cookie header)
i had to write temporary wrapper to support cookies.. :\
from graphql-request.
Yes this is working for me :)
from graphql-request.
yeah well i forgot to mention that i'm using the library from node and not browser.
from graphql-request.
You made me dig again with your replay.
i was able to replace my ugly big wrapper with just this line:
global['fetch'] = require('fetch-cookie/node-fetch')(require('node-fetch'))
Now graphql-request
just works for node as well.
@schickling i think this is worth mentioning in README.MD
would you like me to open a PR?
NOTE: this won't solve per client cookie, since fetch is global.
if we want to support per GraphQLClient cookie we will need to be able to inject fetch function on client constructor. then we can pass different fetch for each client.
from graphql-request.
Thanks a lot for bringing this up @DxCx! It would be great if you could mention it briefly in the readme.
Regarding injecting fetch
: Let's keep this issue open to see whether other people also have this problem before we're changing the API. @DxCx can you close this issue and create a new one with this concrete suggestion?
from graphql-request.
the injection is optional, which means, if no fetch is given in option, it will use fetch as it uses it today. but great! i'll update the README
from graphql-request.
Related Issues (20)
- Cannot find module 'graphql-request/build/esm/types' or its corresponding type declarations.ts HOT 10
- Extension to bring back file upload support
- How do get the IP address of the client in the request middleware?
- I want the GraphQLClient instance to return response headers along with data HOT 2
- Include a new option to ignore operationName to avoid parsing for extraction. HOT 1
- How to pass headers while using `getServerSideProps` HOT 1
- Image Upload HOT 1
- Dynamic Headers: use async function to get headers HOT 2
- TypeError: response.headers.forEach is not a function HOT 1
- `client.request()` does not take a `signal` option as shown in examples HOT 2
- Invalid execution result: data is not plain object HOT 6
- ts-client custom scalars
- Support passing relative path for URL HOT 7
- Variables typing gives unexpected error HOT 1
- `TypeError: Only absolute URLs are supported` when testing with jsdom. HOT 2
- Link to custom fetch function in README.md is not working
- Prevent request in request middleware and return some cached response
- Access request options in responseMiddleware HOT 3
- Add request headers to a client error in a response middleware HOT 3
- Memoizing fetch error: Body is unusable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-request.