Comments (2)
Hey @rjoaopereira, sorry for the delay in responding to this.
Can you help me understand what you're trying to do that this behavior is breaking?
- Do you want to set a body as a plain text (double-quote escaped?) string and have us still set the
application/json
header since it's valid JSON? - Are you trying to pass in already stringified JSON as the body and have us recognize that and set the header?
For 1: I'm not sure I see the value, but if this is your use case I'm interested to hear about it. Why is it useful to set that header?
For 2: I think this adds a fair amount of overhead to look at every string body, try and parse it, then assign the header if it succeeds (unless there's a better, faster way to detect valid JSON). Would parsing the object in the resolver or in the fails()
function be reasonable?
This can be worked around right now (in the v3 version) by using the willSendRequest
hook to inspect the body and set the header yourself if you choose to do that. Unfortunately this can't be done in v4 yet due to a separate issue (which I have a PR open for).
from datasource-rest.
We think this is working as intended. Happy to discuss further.
from datasource-rest.
Related Issues (20)
- RESTDataSource’s willSendRequest parameter changes HOT 2
- Get/Set HTTP Status? HOT 1
- willSendRequest this.context does not exist on xxxxDataSource HOT 1
- `didReceiveResponse` hook no longer available, blocking Apollo v4 upgrade HOT 6
- Errors stop getting sent to client if the override of fetch includes a catch callback HOT 2
- Configuring external caching in Apollo v4 HOT 3
- Question related to changes in request parameters HOT 2
- RESTDataSource implementation issue with `willSendRequest` & `@apollo/utils.withrequired` is a devDependency HOT 4
- Apollo Datasource adds content-type: header when Content-Type (case sensitive) header is set HOT 3
- RESTDataSource no longer have access to all datasources through context HOT 2
- Document `contextValue` recipe for circular references in context object
- Posting FormData as body (for file uploads) not possible anymore HOT 7
- Forward all cache options to key value cache HOT 6
- Unable to connect to Localhost server HOT 1
- @apollo/datasource-rest willSendRequest param type missing `agent` HOT 7
- [apollo-datasource-rest] Handling 404 errors HOT 2
- Feature request - be able to tell if API was resolved by memory, cache, or source HOT 3
- RESTDataSource - body based cacheKeyFor POST request HOT 3
- Feature request: More control over readResponseAndWriteToCache method HOT 4
- Why the introduction of response.clone() in HTTPCache class? HOT 4
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 datasource-rest.