diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-06-12 17:44:34 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-06-12 17:44:34 -0400 |
commit | c650b605d88cd5c6ca5ab38247f240a192810c1d (patch) | |
tree | 22daca90ac99da0244b2cc1d24bef4c472af85f4 /tests/blob.ur | |
parent | 3175ee735c4f753a8e1d70f5a9f47206f5a44a75 (diff) |
Keep user-set response headers on indirect returns
Diffstat (limited to 'tests/blob.ur')
-rw-r--r-- | tests/blob.ur | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/tests/blob.ur b/tests/blob.ur index c6106686..02f88f0d 100644 --- a/tests/blob.ur +++ b/tests/blob.ur @@ -1,27 +1,7 @@ -sequence s -table t : { Id : int, Nam : option string, Data : blob, Desc : string, Typ : string } +fun main () = + setHeader (blessResponseHeader "X-Test") "Test"; + return <xml><body>Test</body></xml> -fun see id = - r <- oneRow (SELECT t.Data, t.Typ FROM t WHERE t.Id = {[id]}); - returnBlob r.T.Data (blessMime r.T.Typ) - -fun save r = - id <- nextval s; - dml (INSERT INTO t (Id, Nam, Data, Desc, Typ) - VALUES ({[id]}, {[fileName r.Data]}, {[fileData r.Data]}, {[r.Desc]}, {[fileMimeType r.Data]})); - main () - -and main () = - ls <- queryX (SELECT t.Id, t.Desc, octet_length(t.Data) AS Len FROM t ORDER BY t.Desc) - (fn r => <xml><li><a link={see r.T.Id}>{[r.T.Desc]} ({[r.Len]})</a></li></xml>); - return <xml><body> - {ls} - - <br/> - - <form> - <textbox{#Desc}/> - <upload{#Data}/> - <submit action={save}/> - </form> - </body></xml> +fun bad () = + setHeader (blessResponseHeader "X-Test") "Test"; + returnBlob (textBlob "hello") (blessMime "text/plain") |