Skip to content

Commit

Permalink
Rename ApolloServer.request to graphQLServerOptionsForRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed May 30, 2018
1 parent 98ef6f0 commit a64909b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/apollo-server-cloudflare/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface FetchEvent extends Event {

export class ApolloServer extends ApolloServerBase {
public async listen() {
const graphql = this.request.bind(this);
const graphql = this.graphQLServerOptionsForRequest.bind(this);
addEventListener('fetch', (event: FetchEvent) => {
event.respondWith(graphqlCloudflare(graphql)(event.request));
});
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-core/src/ApolloServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function createHttpServer(server) {

runHttpQuery([req, res], {
method: req.method,
options: server.request(req as any),
options: server.graphQLServerOptionsForRequest(req as any),
query: JSON.parse(body),
request: new MockReq(),
})
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-core/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export class ApolloServerBase<Request = RequestInit> {
}
}

request(request: Request) {
graphQLServerOptionsForRequest(request: Request) {
let context: Context = this.context ? this.context : { request };

//Defer context resolution to inside of runQuery
Expand Down
6 changes: 5 additions & 1 deletion packages/apollo-server-express/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ export const registerServer = async ({
})(req, res, next);
}
}
return graphqlExpress(server.request.bind(server))(req, res, next);
return graphqlExpress(server.graphQLServerOptionsForRequest.bind(server))(
req,
res,
next,
);
},
);
};
2 changes: 1 addition & 1 deletion packages/apollo-server-hapi/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ server.listen({ http: { port: YOUR_PORT_HERE } });
plugin: graphqlHapi,
options: {
path: path,
graphqlOptions: server.request.bind(server),
graphqlOptions: server.graphQLServerOptionsForRequest.bind(server),
route: {
cors: typeof cors === 'boolean' ? cors : true,
},
Expand Down

0 comments on commit a64909b

Please sign in to comment.