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

44.44% Statements 4/9
0% Branches 0/3
0% Functions 0/1
57.14% Lines 4/7

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 12 13    1x   1x   1x         1x  
'use strict';
 
import * as _ from 'lodash';
 
const ALLOWED_METHODS: string[] = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'];
 
const fixRouteMethod: Function = (route: any, verbose: boolean = false): string => {
	Iif (ALLOWED_METHODS.includes(_.toUpper(route.method))) return _.toUpper(route.method);
	Iif (verbose) console.log('[@owservable/fastify-auto-routes] -> INVALID METHOD', route);
	return 'GET';
};
export default fixRouteMethod;