From 6a22a7d0da8248c61f26d032aec1c1cc2b8dddbd Mon Sep 17 00:00:00 2001 From: Shane Myrick Date: Mon, 22 Jul 2024 16:47:10 -0700 Subject: [PATCH] [docs] Update docs on where response extensions can be mutated (#7876) I couldn't find any articles or docs on how to do this as I was attempting myself to debug an issue for a customer --------- Co-authored-by: Maria Elisabeth Schreiber --- docs/source/integrations/plugins-event-reference.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/integrations/plugins-event-reference.mdx b/docs/source/integrations/plugins-event-reference.mdx index df505f78a88..e6a10614268 100644 --- a/docs/source/integrations/plugins-event-reference.mdx +++ b/docs/source/integrations/plugins-event-reference.mdx @@ -487,6 +487,8 @@ if the GraphQL operation encounters one or more errors. (If the operation uses [incremental delivery](../workflow/requests#incremental-delivery-experimental) directives such as `@defer`, `willSendResponse` is called before the *initial* payload is sent; you can use `willSendSubsequentPayload` to find out when more payloads will be sent.) +The `willSendResponse` event is also where you can mutate the GraphQL response in-place. For example, you can add values to the `extensions` object or redact information in the `data` block. If you need to mutate the error responses, see the [`formatError` hook](https://www.apollographql.com/docs/apollo-server/data/errors/#for-client-responses). + ```ts willSendResponse?( requestContext: WithRequired<