[Ur] Handling POST requests that aren't from forms
Adam Chlipala
adamc at impredicative.com
Thu Dec 16 10:33:28 EST 2010
Chris Double wrote:
> Thanks, I'll use a proxy script in the meantime.
I should also mention that it would work fine to do your simple table
insert from a different programming language. You can consult the SQL
source files that Ur/Web will generate with the 'sql' directive, to see
the schemas that are being produced.
> An approach I was thinking of was to provide a 'requestBody' function:
> val requestBody : unit -> transaction blob
>
I'm not too keen on this approach, since it would allow any function to
read the request body, even if the main function "doesn't want" to allow
it. I'd much rather have this reflected in the type of the request
handler, as an extra argument.
> Can a blob be converted to a string?
Clearly you can write a function from blobs to strings, by always
returning the empty string. ;)
I don't think there is a single well-defined mathematical function that
everyone would agree you mean in your question.
> Or have some conversion done based on a mime type
>
Building this "conversion" into the compiler seems scary and
unnecessary. The type [file] from the standard library seems like a
natural fit if you want to combine a MIME type with binary data.
However, isn't POST data restricted to be in a normal text encoding,
anyway, such that it would be reasonable to use a string?
More information about the Ur
mailing list