Skip to content

A Plugin To Manipulate Cookies? #1006

Answered by dotansimha
ajoslin103 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!
Are you referring to set cookies through the response of the GraphQL result? If you are referring to something like Set-Cookie headers (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) ?

Basically, envelop aims to avoid dealing with things that are specific to your transport, so from envelop point-of-view, it's out of scope.

To address that in a generic way to send headers, I think you can create a simple plugin like that:

const useResponseHeadersPlugin = () => {
  return {
    onContextBuilding({ extendContext }) {
       extendContext({
           responseHeaders: new Set()
       });
    },
    onExecute({ args }) {
       return {
           onExecuteDone({ re…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
6 replies
@dotansimha
Comment options

@ajoslin103
Comment options

@ajoslin103
Comment options

@dthyresson
Comment options

@dthyresson
Comment options

Answer selected by n1ru4l
Comment options

You must be logged in to vote
2 replies
@dthyresson
Comment options

@ajoslin103
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants