-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
didReceiveResponse
hook no longer available, blocking Apollo v4 upgrade
#143
Comments
didReceiveResponse
hook no longer available, blocking v4 upgradedidReceiveResponse
hook no longer available, blocking Apollo v4 upgrade
It's a blocker for me too |
Hey @grego-e and @dycor. Have you taken a look at #109? I do think overriding It seems like there's enough interest here that I'm tempted to reinstate the hook, but I'm a bit hesitant only because people upgrading need to be aware of the subtle-ish change in semantics. I guess that's why we read changelogs, especially through major version upgrades. I'd be open to a PR which adds some form of the hook back. Maybe cc @glasser |
I do feel like if the use case is "do something different right at the end of |
I need to access to the headers response , and with didReceiveResponse I can do this |
In my suggestion you can access the response headers like so: class MyDataSource extends RESTDataSource {
override async fetch<TResult>(
path: string,
incomingRequest: DataSourceRequest = {},
) {
return super.fetch<TResult>(path, incomingRequest).then((result) => {
const response = result.response;
const headers = response.headers;
if (!response.ok) {
// mutate response object accordingly
}
return result;
});
}
} |
Thanks for the |
We are upgrading an Apollo server to v4 and noticed that in datasource-rest v5
didReceiveResponse
hook was removed https://github.com/apollographql/datasource-rest/releases/tag/v5.0.0 .With our current codebase we use that hook for adding some headers which would be fine with moving to the parseBody hook however, we also do some logging there that relies on both the request and response objects that were available in
didReceiveResponse
previously and are not in parseBody.4b2a6f9 This commit message implies that this hook could be reinstated and we found a valid use case for it too. At the moment this is a blocker for us - could you consider adding this hook back and if yes, approximately when can we expect it?
Thank you
The text was updated successfully, but these errors were encountered: