How to use the http-errors.LengthRequired function in http-errors

To help you get started, we’ve selected a few http-errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / http-errors_v1.x.x / test_http-errors_v1.x.x.js View on Github external
import HttpErrors from 'http-errors';

const A: HttpErrors.HttpError = new HttpErrors.HttpError();
const B: HttpErrors.HttpError = HttpErrors();
const C: HttpErrors.HttpError = HttpErrors(200, 'foo', {});
// $ExpectError
const D: HttpErrors.HttpError = HttpErrors('500');
const E: HttpErrors.NotFound = new HttpErrors.NotFound();
const F: HttpErrors.HttpError = new HttpErrors.LengthRequired;
const G: HttpErrors.HttpError = new HttpErrors.HttpError('foo');

(F.expose: bool);
(F.message: string);
(F.status: number);
(F.statusCode: number);
github fastify / fastify-sensible / lib / httpErrors.js View on Github external
lengthRequired: function lengthRequired (message) {
    return new createError.LengthRequired(message)
  },