When the condition does not work metamuja resource file
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Desc> Example Resource </Desc>
<Query when="x eq true">
SELECT 'true'
</Query>
<Query when="x eq false">
SELECT 'false'
</Query>
</Request>
</Resource>
When I send the x parameter, the server responds with 412 Precondition Failed
Error
source to share
The conditional requests attribute is used in the resource
file . Thus, the conditional expression is expected in the attribute .
In your case, since you said you were sending as a parameter, you need to write it this waywhen
when
x
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Desc> Example Resource </Desc>
<Query when="$x eq true">
SELECT 'true'
</Query>
<Query when="$x eq false">
SELECT 'false'
</Query>
</Request>
</Resource>
The variable prefix $
denotes it as variable
, if not, then it is constructed as a String
literal, which in this case must enclose it with quotes. Example.
<Query when="'x' eq false">
//your query
</Query>
source to share