@fastify/sensible
Advanced tools
Comparing version 5.4.0 to 5.5.0
@@ -84,1 +84,2 @@ 'use strict' | ||
module.exports.fastifySensible = fastifySensible | ||
module.exports.httpErrors = httpErrors |
@@ -102,1 +102,4 @@ interface HttpError extends Error { | ||
} & Record<HttpErrorNames, (msg?: string) => HttpError>; | ||
declare const HttpErrors: HttpErrors | ||
export default HttpErrors; |
{ | ||
"name": "@fastify/sensible", | ||
"version": "5.4.0", | ||
"version": "5.5.0", | ||
"description": "Defaults for Fastify that everyone can agree on", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -84,2 +84,8 @@ 'use strict' | ||
test('should throw error', (t) => { | ||
const err = Sensible.httpErrors.conflict('custom') | ||
t.equal(err.message, 'custom') | ||
t.end() | ||
}) | ||
function normalize (code, msg) { | ||
@@ -86,0 +92,0 @@ if (code === '414') return 'uriTooLong' |
import { FastifyPluginCallback, FastifyReply } from 'fastify' | ||
import { HttpErrors, HttpErrorCodes, HttpErrorNames } from "../lib/httpError" | ||
import { HttpErrors } from "../lib/httpError" | ||
import * as Errors from '../lib/httpError' | ||
@@ -96,2 +96,4 @@ | ||
export const httpErrors: typeof Errors.default | ||
export type HttpErrorReplys = { | ||
@@ -98,0 +100,0 @@ getHttpError: (code: HttpErrorCodes, message?: string) => FastifyReply; |
import { expectType, expectAssignable, expectError, expectNotAssignable } from 'tsd' | ||
import fastify from 'fastify' | ||
import fastifySensible, { SensibleOptions } from '..' | ||
import fastifySensible, { SensibleOptions, httpErrors } from '..' | ||
@@ -152,1 +152,4 @@ const app = fastify() | ||
}) | ||
httpErrors.forbidden('This type should be also available'); | ||
httpErrors.createError('MyError'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61704
1524