Skip to content

Commit 9e55a55

Browse files
committed
fix: allow configurable method override
1 parent 8d360d7 commit 9e55a55

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,17 @@ class Web {
298298
// flash messages
299299
app.use(flash());
300300

301-
// method override
302-
// (e.g. `<input type="hidden" name="_method" value="PUT" />`)
303-
app.use(methodOverride());
304-
305301
// body parser
306302
app.use(bodyParser());
307303

308304
// pretty-printed json responses
309305
app.use(json());
310306

307+
// method override
308+
// (e.g. `<input type="hidden" name="_method" value="PUT" />`)
309+
if (this.config.methodOverride)
310+
app.use(methodOverride(...this.config.methodOverride));
311+
311312
// ajax request detection (sets `ctx.state.xhr` boolean)
312313
app.use(isajax());
313314

0 commit comments

Comments
 (0)