All files / middleware override.ts

100% Statements 6/6
100% Branches 6/6
100% Functions 2/2
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12    5x 12x 3x 2x 2x   3x      
import Overland from '../core/Overland';
 
export default function override(app?: Overland) {
  return async function override(ctx, next?) {
    if (ctx.request && ctx.request.body) {
      const method = ctx.request.body._method;
      ctx.method = method ? method : ctx.method;
    }
    return await next();
  };
}