[Ur] GET vs. POST

Adam Chlipala adamc at impredicative.com
Mon Dec 19 19:06:05 EST 2011


James Parker wrote:
> I've run into another issue implementing my signout function. When I compile, I get the following error:
>
> A link (Umdtalks/signout) could cause side effects; try implementing it with a form instead
>
> To address this, the manual says something about using an argument of type Basis.postType. Is there an example of this somewhere?

I don't recommend using [postType] here.  Instead, you want the normal 
form support.

> I would really like to keep this a link. Also, my signout function takes no arguments so should it really make a difference whether the link is using POST vs. GET variables?
>    

Then you would be going against the HTTP standard semantics, which says 
that GET requests may not cause side effects (and there is no way to use 
POST from a link without some fancy JavaScriptin').  You could whitelist 
the [signout] function for side-effecting GETs using the [safeGet] .urp 
directives.  Alternatively, this slight modification on Marc's suggested 
code should also work:

<form>
<submit value="logout" action={signout}/>
</form>

P.S.: I'm changing the thread subject, which had become misleading. ;)



More information about the Ur mailing list