nuxt-graphql-client icon indicating copy to clipboard operation
nuxt-graphql-client copied to clipboard

Passing Headers in Gql Functions

Open danwritecode opened this issue 2 years ago • 3 comments
trafficstars

Environment

  • Operating System: Linux
  • Node Version: v16.18.0
  • Nuxt Version: 3.7.1
  • CLI Version: 3.8.3
  • Nitro Version: 2.6.3
  • Package Manager: [email protected]
  • Builder: -
  • User Config: runtimeConfig, devtools, modules
  • Runtime Modules: @nuxtjs/[email protected], [email protected]
  • Build Modules: -

Describe the bug

There is seemingly no way to pass headers to Gql Functions: https://nuxt-graphql-client.web.app/getting-started/gql-functions

This is an issue because if I want to use a Gql Function in a server route, the Token is no longer included in the request. I would like to be able to just extract the token from the event headers and pass it manually into the function so I can use the Gql Function server side.

Expected behaviour

To be able to pass an options object or something like that where I can specify headers.

Reproduction

No response

Additional context

No response

Logs

No response

danwritecode avatar Sep 26 '23 17:09 danwritecode

what about passing headers with this composable? https://nuxt-graphql-client.web.app/getting-started/composables#usegqlheaders

useGqlHeaders({ 'X-Custom-Header': 'value' })```

tasiotas avatar Oct 02 '23 00:10 tasiotas

It seems like a duplicate of #328.

iBobik avatar Jan 29 '24 16:01 iBobik

what about passing headers with this composable? https://nuxt-graphql-client.web.app/getting-started/composables#usegqlheaders

useGqlHeaders({ 'X-Custom-Header': 'value' })```

Sometimes I do not want to set token/header for all subsequent requests.

iBobik avatar Jan 29 '24 16:01 iBobik