RevereCRE / relay-nextjs

⚡️ Relay integration for Next.js apps
https://reverecre.github.io/relay-nextjs/
MIT License
251 stars 30 forks source link

Try to expose GraphQL response headers to serverSidePostQuery #90

Open Meemaw opened 1 year ago

Meemaw commented 1 year ago

It would be great if response headers from the GraphQL request done on server would be exposed to serverSidePostQuery.

Use-case: Backend can set the cache-control header on GraphQL responses, which could be read in serverSidePostQuery and set on the page:

serverSidePostQuery: (_, ctx) => {
    ctx.res.setHeader(
      'cache-control',
      headerFromBackend
    );
  }

Could try to contribute this, if you think this makes sense and would be open to accepting PR for it.

rrdelaney commented 1 year ago

This is a great idea! Would happily accept a PR!