All files / src/functions fix.route.method.ts

100% Statements 8/8
100% Branches 9/9
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11    6x   6x 47x 11x 11x   6x  
'use strict';
 
const ALLOWED_METHODS: string[] = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'];
 
const fixRouteMethod: Function = (route: any, verbose: boolean = false): string => {
	if (ALLOWED_METHODS.includes(route.method?.toUpperCase())) return route.method.toUpperCase();
	if (verbose) console.log('[@owservable/fastify-auto-routes] -> INVALID METHOD', route);
	return 'GET';
};
export default fixRouteMethod;