Skip to content

Commit

Permalink
[docs] Update docs on where response extensions can be mutated (#7876)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
smyrick and Meschreiber authored Jul 22, 2024
1 parent 8f85bca commit 6a22a7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/integrations/plugins-event-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit 6a22a7d

Please sign in to comment.