mozilla-services/msisdn-gateway

Middleware with general request validation

Closed this issue · 3 comments

We want a function to check the request for:

  • status code 400, errno 106: request body was not valid json
  • status code 411, errno 112: content-length header was not provided
  • status code 413, errno 113: request body too large

The first one is currently handled by bodyParser - but it does not have the desired behavior

refs #53

@ckarlof is there any reusable code in FxA for this ?

After investigation (thanks @zaach!) FxA uses hapi and has this : https://github.com/mozilla/fxa-auth-server/blob/master/error.js#L190

we use express. we'll drop express.json() and create our own function to do all those checks