diff options
author | 2012-07-21 15:16:57 -0400 | |
---|---|---|
committer | 2012-07-21 15:16:57 -0400 | |
commit | efeb64a601c052ed533caee0131befe2c96bb91c (patch) | |
tree | 4be6d87576e314c5a2a1ecbaed89913bceca422f /lib/ur/top.ur | |
parent | 8ac6c0fe4425753c64fa0ef0a129d33eef36cb5c (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 |