diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-07-21 15:16:57 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-07-21 15:16:57 -0400 |
commit | cbce1b6184acae87ba220969ab2c69cf2697ea32 (patch) | |
tree | 4be6d87576e314c5a2a1ecbaed89913bceca422f /lib/ur/top.ur | |
parent | 17e8230265e8fb22d583c4ba33d4243f24d6b8bc (diff) |
Top.postFields
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r-- | lib/ur/top.ur | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur index e504204e..5b9d43ab 100644 --- a/lib/ur/top.ur +++ b/lib/ur/top.ur @@ -393,3 +393,15 @@ fun mkRead' [t ::: Type] (f : string -> option t) (name : string) : read t = mkRead (fn s => case f s of None => error <xml>Invalid {txt name}: {txt s}</xml> | Some v => v) f + +fun postFields pb = + let + fun postFields' s = + case firstFormField s of + None => [] + | Some f => (fieldName f, fieldValue f) :: postFields' (remainingFields f) + in + case postType pb of + "application/x-www-form-urlencoded" => postFields' (postData pb) + | _ => error <xml>Tried to get POST fields, but MIME type is not "application/x-www-form-urlencoded"</xml> + end |