Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apollo-server-core: pass req obj to context when invoking executeOperation #2478

Commits on Mar 21, 2019

  1. apollo-server-core: pass req obj to context when invoking executeOper…

    …ation
    
    Fixes apollographql#2277.
    
    `apollo-server-testing` relies on `apollo-server-core` to execute queries
    for integration tests, via the `executeOperation` method.
    
    However, when executing a query via `executeOperation`, `apollo-server-core`
    was not passing the `req` object to the `context` callback function used
    to create the server.
    
    This is fine if you're using a mock `context` object directly in
    your tests, but for tests that want to run a `context` callback that
    contains logic that depends on that `req` object, it would fail.
    
    Note that long-term the best fix for this is that `apollo-server-testing`
    should use the `ApolloServer` class from `apollo-server-express` internally,
    instead of `ApolloServerBase` from `apollo-server-core`, since it seems
    like that is the class that is used by default in `apollo-server`.
    vitorbal committed Mar 21, 2019
    Configuration menu
    Copy the full SHA
    93909b4 View commit details
    Browse the repository at this point in the history