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

vweb: fix parsing of form fields, send with multipart/form-data (by JS fetch)

This commit is contained in:
Delyan Angelov
2023-07-14 16:07:52 +03:00
parent f1bc5e6d46
commit 9047f7c9a8
5 changed files with 72 additions and 24 deletions

View File

@ -89,6 +89,11 @@ pub fn (mut app App) json_echo() vweb.Result {
return app.ok(app.req.data)
}
['/login'; post]
pub fn (mut app App) login_form(username string, password string) vweb.Result {
return app.html('username: x${username}x | password: x${password}x')
}
['/form_echo'; post]
pub fn (mut app App) form_echo() vweb.Result {
app.set_content_type(app.req.header.get(.content_type) or { '' })