Skip to content

Commit

Permalink
Prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Jun 24, 2019
1 parent 537db35 commit ba97c0c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
28 changes: 16 additions & 12 deletions packages/apollo-server-lambda/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,27 @@ export class ApolloServer extends ApolloServerBase {
const resultPromise = promiseWillStart.then(() => {
return this.createGraphQLServerOptions(event, context).then(options => {
return graphqlLambda(options)(event, context).then(result => {
return result && {
...result,
headers: {
...result.headers,
...requestCorsHeadersObject,
},
};
return (
result && {
...result,
headers: {
...result.headers,
...requestCorsHeadersObject,
},
}
);
});
});
});

if (callback) {
resultPromise.then(result => {
callback(null, result);
}).catch(error => {
callback(error);
})
resultPromise
.then(result => {
callback(null, result);
})
.catch(error => {
callback(error);
});
} else {
return resultPromise;
}
Expand Down
30 changes: 15 additions & 15 deletions packages/apollo-server-lambda/src/lambdaApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function graphqlLambda(

const graphqlHandler: APIGatewayProxyAsyncHandler = async (
event,
context
context,
) => {
if (event.httpMethod === 'POST' && !event.body) {
return {
Expand All @@ -37,22 +37,22 @@ export function graphqlLambda(
}

try {
const {
graphqlResponse,
responseInit
} = await runHttpQuery([event, context], {
method: event.httpMethod,
options: options,
query:
event.httpMethod === 'POST' && event.body
? JSON.parse(event.body)
: event.queryStringParameters,
request: {
url: event.path,
const { graphqlResponse, responseInit } = await runHttpQuery(
[event, context],
{
method: event.httpMethod,
headers: new Headers(event.headers),
options: options,
query:
event.httpMethod === 'POST' && event.body
? JSON.parse(event.body)
: event.queryStringParameters,
request: {
url: event.path,
method: event.httpMethod,
headers: new Headers(event.headers),
},
},
});
);

return {
body: graphqlResponse,
Expand Down

0 comments on commit ba97c0c

Please sign in to comment.