Skip to content

ClientAwareness headers in v12 applied only when setting them in defaultContextΒ #2385

@vz-tl

Description

@vz-tl

Describe the bug

When configuring ClientAwareness headers in apollo-angular v12, they only will become applied to the request when configuring them in the query context or by configuring them globally in the defaultContext. But the regular way to configure them directly in the ApolloClient.Options like before v12, doesn't work anymore:

provideApollo(() => ({
  link: inject(HttpLink).create({
    uri: '/graphql',
    withCredentials: true
  }),
  cache: new InMemoryCache(),
  clientAwareness: { // <-- this is the regular place to configure clientAwareness which worked before v12
    name: 'my-client-name',
    version: 'dev.0.0.1'
  },
  defaultContext: {
    clientAwareness: {  // <-- only when adding the clientAwareness config here, the related headers will become applied 
      name: 'my-client-name',
      version: 'dev.0.0.1'
    }
  }
}));

Expected behavior

clientAwareness configuration should be applied when adding them to the default location in ApolloClient.Options as before v12

Environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions