Vue-apollo: Http Headers for individual querys?

Created on 28 Jul 2020  路  1Comment  路  Source: vuejs/vue-apollo

I want to use http headers, actually is reference about use and set up over the vue-apollo.js file with httpLinkOptions. but is possible to use different header in an individual query?

Most helpful comment

Use the context system.
https://www.apollographql.com/docs/link/links/http/#passing-context-per-query

For example:

export default {
  apollo: {
    myQuery () {
      return {
        query: gql`...`,
        context: {
          headers: { foo: this.fooHeader }
        }
      }
    }
  }
}

>All comments

Use the context system.
https://www.apollographql.com/docs/link/links/http/#passing-context-per-query

For example:

export default {
  apollo: {
    myQuery () {
      return {
        query: gql`...`,
        context: {
          headers: { foo: this.fooHeader }
        }
      }
    }
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

apertureless picture apertureless  路  4Comments

dsbert picture dsbert  路  4Comments

jsrkstr picture jsrkstr  路  3Comments

beeplin picture beeplin  路  4Comments

chadwtaylor picture chadwtaylor  路  3Comments