Apollo-server: [graphql-server-hapi] how can i get hapi's request object in resolvers?

Created on 14 Mar 2017  路  2Comments  路  Source: apollographql/apollo-server

I want use some headers in http request,
but i cant find any way get the request header in resolvers.

Most helpful comment

Maybe, you should try something like this?

this.server.register({
  register: graphqlHapi,
  options: {
    path: '/graphql',
    graphqlOptions: async (request) => {
      return {
        schema,
        context: request
      }
    }
  }
});

All 2 comments

Maybe, you should try something like this?

this.server.register({
  register: graphqlHapi,
  options: {
    path: '/graphql',
    graphqlOptions: async (request) => {
      return {
        schema,
        context: request
      }
    }
  }
});

thank you @Aurelsicoko ,It's works.

Was this page helpful?
0 / 5 - 0 ratings