Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Simplify getGraphQLParams
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 11, 2020
1 parent 205c859 commit b2f7297
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,20 +460,9 @@ export type GraphQLParams = {|
export async function getGraphQLParams(
request: $Request,
): Promise<GraphQLParams> {
const { url = '' } = request;
const urlData = new URLSearchParams(url.split('?')[1]);
const urlData = new URLSearchParams(request.url.split('?')[1]);
const bodyData = await parseBody(request);

return parseGraphQLParams(urlData, bodyData);
}

/**
* Helper function to get the GraphQL params from the request.
*/
function parseGraphQLParams(
urlData: URLSearchParams,
bodyData: { [param: string]: mixed, ... },
): GraphQLParams {
// GraphQL Query string.
let query = urlData.get('query') ?? bodyData.query;
if (typeof query !== 'string') {
Expand Down

0 comments on commit b2f7297

Please sign in to comment.