Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Handle empty body #174

@ojongerius

Description

@ojongerius

Hitting Graphql with an empty body is not supported, but we currently expose an error from apollo-server, which we should dress up a little nicer.

▶ curl -X POST https://hxtsoafqna.execute-api.us-east-1.amazonaws.com/stage/graphql
POST body missing. Did you forget use body-parser middleware?%

Find code that generates the error at https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-core/src/runHttpQuery.ts#L67

 switch (request.method) {
    case 'POST':
      if (!request.query || Object.keys(request.query).length === 0) {
        throw new HttpQueryError(
          500,
          'POST body missing. Did you forget use body-parser middleware?',
        );
      }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions