Accept POST requests from HTML forms

This commit is contained in:
Joe Nelson
2016-05-15 20:55:07 -07:00
parent 0dbd0ece9a
commit 7e41b620ff
3 changed files with 14 additions and 0 deletions
+4
View File
@@ -122,6 +122,10 @@ userApiRequest schema req reqBody =
Nothing -> PayloadParseError "All lines must have same number of fields"
Just json -> PayloadJSON json)
(CSV.decodeByName reqBody)
Left "application/x-www-form-urlencoded" ->
PayloadJSON . UniformObjects . V.singleton . M.fromList
. map (cs *** JSON.String . cs) . parseSimpleQuery
$ cs reqBody
Left accept ->
PayloadParseError $
"Content-type not acceptable: " <> accept