1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: split and parse Content-Type header correctly (#9756)

This commit is contained in:
Miccah
2021-04-16 00:46:06 -05:00
committed by GitHub
parent b11b744630
commit e2be3ec396
5 changed files with 37 additions and 5 deletions

View File

@@ -85,6 +85,12 @@ pub fn (mut app App) json_echo() vweb.Result {
return app.ok(app.req.data)
}
['/form_echo'; post]
pub fn (mut app App) form_echo() vweb.Result {
app.set_content_type(app.req.header.get(.content_type) or { '' })
return app.ok(app.form['foo'])
}
// Make sure [post] works without the path
[post]
pub fn (mut app App) json() vweb.Result {